2.1 Getting RStudio to run on your computer

As a prerequisite for this guide, you need to have RStudio and a few essential R packages installed.

You have to follow these steps to get your RStudio version set.

  1. Download RStudio on the RStudio Website (Link). It’s free!
  2. If you do not have R installed yet, you will have to install the latest R Version before you can use RStudio. You can get the latest R version here. You have to choose the right R version depending on the operating system you use (i.e., Windows or Mac).
  3. Once RStudio is running, open the Console on the bottom left corner of your screen.
  4. We will now install a few packages using R code. Here’s an overview of the packages, and why we need them:
Package Description
tidyverse This is a large bundle of packages which make it easy to manipulate and visualize data in R. Functions included in the tidyverse have become very popular in the R community in recent years, and are used by many researchers, programmers and data scientists. If you want to learn more about the tidyverse, you can click on this link: https://www.tidyverse.org/.
meta This package contains functions which make it easy to run different types of meta-analyses. We will primarily focus on this package in the guide, because it is easy to use, well documented, and very versatile. More info on the meta package can be found here: http://www.imbi.uni-freiburg.de/lehre/lehrbuecher/meta-analysis-with-r.
metafor The metafor package is also dedicated to conducting meta-analyses, and a true ‘powerhouse’ in terms of functionality. The package also provides more advanced tools, but may be a little involved for first time R users. However, because we will use this package at times in later chapters, and because metafor is used by the meta package for many applications, it is best to have it installed. The metafor package also has an excellent documentation for various meta-analysis-related topics, which can be found here: http://www.metafor-project.org/doku.php/metafor.

5. To install these packages, we use the install.packages() function in R. One package after another, our code should look like this:


In RStudio, you simply have to type in the code displayed above into the the Console (usually, this is the bottom-left pane in your RStudio window) next to the little arrow (>) in the last line. Then hit Enter ⏎.

Don’t forget to put the packages in "".

Otherwise, you will get an error message.

You are now set and ready to proceed. Below, you can find some basic information on RStudio and troubleshooting

2.1.1 Running R Code

Order to get the most out of this guide, it’s helpful (but not essential) if you have some programming experience already. If you’ve never programmed before, you might find Hands-On Programming with R (Grolemund 2014) to be a useful primer.

There are three things you need to run the code: R, RStudio, and collection of R packages. Packages are the fundamental units of reproducible R code. They include reusable functions, the documentation that describes how to use them, and sample data.

Gladly, once you’ve reached this point successfully, these three things are set already. Nevertheless, we will have to install and load a few new packages at some place in this guide, for which you can use the install.packages() the same way as you did before.

2.1.2 Getting Help

As you start to apply the functions described in this guide to your data you will soon find questions that the guide does not answer. This section describes a few tips on how to get help.

  • A great asset of working with R is that most packages come with great documentation material showing you how to use functions. In RStudio, it is very easy to access the documentation: in the Console, simply put a question mark in front of the function you want to use, and then hit Enter. If a documentation file for the function exists, a page should open in the Help (bottom-right corner) pane of your RStudio window. This page will then show the arguments required to use the function, and what the function does. As an example, you can write ?sum into your Console. If you then hit Enter, the documentation for the sum() function should be displayed in the Help pane.
  • If you get stuck somewhere, the best way is to start with Google. Google is particularly useful for error messages. If you get an error message and you have no idea what to do with it, try googling it first. The R community is large, and chances are that there will be help somewhere on the web. (If the error message isn’t in English, run Sys.setenv(LANGUAGE = "en") and re-run the code. It is more likely that you will find help for error messages in English.)
  • Lastly, if you stumble upon an error (or typos!) in this guide’s text or R syntax, feel free to contact Mathias Harrer at .


Grolemund, Garrett. 2014. Hands-on Programming with R: Write Your Own Functions and Simulations. O’Reilly.