1 Required set up for the course on EmuR

\(~\)

2 Default browser

Set your default browser to Google Chrome. This is necessary in order to display the Emu web application from R.

\(~\)

3 Create a directory on your hard drive

Create a directory on your hard drive to be used on this course. Here I have created one on my desktop called ipsR - but any directory name is fine.

\(~\)

4 Startup Rstudio

by clicking the Rstudio icon

\(~\)

5 Create a project

Choose the directory that you just created under step 1. See the figure below:

You only need to create the project once. When you startup Rstudio the next time, the system should automatically open up inside this project that you created. If not, or if you closed the project, you can open it again:

You can get back to your default directory (if you were using R before then) any time by selecting close project in the above menu.

6 Install packages

In the Rstudio console window, install the following following (takes a few minutes). You only need to do this once:

install.packages(c("Rcpp", "remotes", "knitr", 
                   "tidyverse", "magrittr",
                   "rmarkdown", "emuR", "gridExtra", "emmeans", 
                   "broom", "lmerTest", "pbkrtest", "MuMIn", "wrassp"))

More information: Installation of R Packets

Should the above result in the error message installation of package had non-zero exit status, then it means that installation has failed. For Windows, you might then additionally have to install Rtools. Für MacOS you might need to install/reset the XCode command-line tools. For this purpose, open a Mac terminal window and execute the following:

xcode-select --install
# Should the R packages installation still not work:
xcode-select --reset

7 loading libraries

Load the tidyverse(), emuR(), and wrassp() libraries. While some base packages are automatically opened when you start up Rstudio, most have to be loaded first using the library() function. This includes the two packages that will be needed right from the beginning of the course:

library(tidyverse)
library(emuR)
library(wrassp)

8 Verification

Verify that everything works by entering the following commands to the console.

# download a demo database
create_emuRdemoData(dir = tempdir())
# load it
ae = load_emuDB(file.path(tempdir(), "emuR_demoData", "ae_emuDB"))
# look at it
serve(ae, useViewer=F)
# close the browser window to carry on

The third command serve(ae, useViewer=F) should produce the following image in your browser

9 Quitting from Rstudio (and R)

Either Session > Quit Session in the main Rstudio toolbar or

q()

You will then be asked whether you want to save the workspace image.

For this course, please never save the workspace i.e. (Don't save)

10 Learning R

A basic knowledge in R is a prerequisite for this course. If you are unfamiliar with R then please start by working through these two sources:

11 Learning R: the community

There is a very large and helpful R community that will make learning R easier for you. Here are a few useful links and commands in case you get stuck:

# for e.g. one of the libraries from tidyverse
vignette("dplyr")
?getwd
help("getwd")

ggplot2 is both a well-known and popular program for creating plots. There’s plenty of help available for ggplot2 from the R community. Here are some useful links for creating graphics:

12 Statistics in R: Literature

If you need more information using statistics in R, the following are recommended: