Installing R and RStudio
adapted from datacarpentry.org
These instructions will help you install R and RStudio for your local computer, as well as several commonly used packages in the lab. You might have R installed already, but check the versions. Please make sure you have install R version 4.3.2
or later and RStudio version 2023.09.0
or later, but if you are installing for the first time just install the most recent versions available.
1 Step 1 - follow instructions for your operating system
1.0.1 For Windows see Section 3
1.0.2 For MacOS see Section 4
1.0.3 For Linux see Section 5
2 Step 2 - install R packages
Open RStudio and Paste the following into your console on the left/bottom-left.
install.packages(c( "colorspace","corncob", "cowplot", "DT", "ggbeeswarm", "ggforce","ggraph","ggtext", "gtsummary","knitr", "naniar", "margins", "palmerpenguins", "patchwork", "quarto", "rmarkdown", "tidyverse"))
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")
::install(c("phyloseq", "microbiome", "ComplexHeatmap","DESeq2"), update = FALSE)
BiocManager
install.packages(
"microViz",
repos = c(davidbarnett = "https://david-barnett.r-universe.dev", getOption("repos"))
)
3 Windows
3.1 If you don’t have R and RStudio installed:
Go to https://posit.co/download/rstudio-desktop/ and follow this instruction for windows.
3.2 If you already have R and RStudio installed, check to see if updates are available.
RStudio: Open RStudio and click on Help > Check for updates. If a new version is available, quit RStudio, and download the latest version.
R: Upon starting RStudio, the version of R you are running will appear on the console. You can also type sessionInfo()
in the console to display the version of R you are running. The CRAN website will tell you if there is a more recent version available. You can update R using the installr
package, by running:
# installr is for windows only!
if( !("installr" %in% installed.packages()) ){install.packages("installr")}
::updateR(TRUE) installr
4 MacOs
4.1 Check your processor
adapted from https://docs.cse.lehigh.edu/determine-mac-architecture/
Make sure you are downloading and installing the right version of R and R Studio for your laptop’s CPU. Some older Macs (pre-2018) have an intel chip (also known as x64 or x86_64 architecture), while recent macs have M1,M2,M3, or M4 chips (also known as ARM architecture).
To determine whether a Mac is running an Intel Processor or Apple ARM M1 or M2, click on the Apple Menu and select ‘About this Mac’:
From the ‘About this Mac’ screen, on the ‘Overview’ tab, look for a line that indicates either ‘Chip’ or ‘Processor’. If the line contains M1 or M2, the machine is running Apple Silicon. Alternatively, the word Intel indicates that the machine is running an Intel-based Core series processor.
4.2 If you don’t have R and RStudio installed:
Go to https://posit.co/download/rstudio-desktop/ and follow this instruction for MacOS.
4.3 If you already have R and RStudio installed, check to see if updates are available.
RStudio: Open RStudio and click on Help > Check for updates. If a new version is available, quit RStudio, and download the latest version.
R: Upon starting RStudio, the version of R you are running will appear on the console. You can also type sessionInfo() to display the version of R you are running. The CRAN website will tell you if there is a more recent version available. For this workshop install version 4.3.1 of R
5 Linux
5.1 If you don’t have R and RStudio installed:
Go to https://posit.co/download/rstudio-desktop/ and follow this instruction for your Linux OS.
5.2 If you already have R and RStudio installed, check to see if updates are available.
RStudio: Open RStudio and click on Help > Check for updates. If a new version is available, quit RStudio, and download the latest version.
R: Upon starting RStudio, the version of R you are running will appear on the console. You can also type sessionInfo() to display the version of R you are running. The CRAN website will tell you if there is a more recent version available. For this workshop install version 4.3.1 of R