Skip to contents

Check that R and RStudio are up to date

You’ll need to do a few things before we can start the course. First you need to check you have up-to-date versions of R and RStudio. This means that R should be at least version 4. You can check by typing this in R:

version$major >= 4

If this is FALSE, download and install a new version from https://www.r-project.org. Then install these packages:

install.packages(c('devtools', 'rstudioapi'))

If you find yourself stuck in a loop of asking you to restart R, then it’s okay to say no.

Then check whether RStudio is up to date:

# Load the rstudioapi library and check RStudio version
library(rstudioapi)
isAvailable("1.4")

# which is equivalent to
rstudioapi::isAvailable("1.4")

Note that rstudioapi::xxx() means “find the xxx() function in the rstudioapi package”.

If FALSE, download and install the latest version of RStudio Desktop and check this has worked by running the above again.

Next, check you are now ready to build R packages:

# Load the devtools library and check whether compilers are installed
library(devtools)
has_devel()

# which is equivalent to
devtools::has_devel()

If this is FALSE or errors, then you will need to follow instructions given by the function or ask for help until this works.

Finally install these packages:

install.packages(c('rdiversity', 'vegan', 'iNEXT'))