2 Install R & RStudio
Learning Objectives: After this chapter you will be able to:
- Install R on Windows, macOS, or Linux from a CRAN mirror.
- Verify an installation by running
R.version.string.- Install RStudio Desktop, after R itself is in place.
- Create an RStudio Project, so working directory, history, and settings travel together in a single
.Rprojfile.
2.1 R
Follow these steps:
- Download R for your operating system from a CRAN mirror (Windows, macOS, or Linux installers are listed there).
- Run the installer with default options.
- Verify the installation by opening a terminal and running
R.version.string.
2.2 RStudio
Follow these steps:
- Download RStudio Desktop from posit.co/download/rstudio-desktop.
- Install it after installing R (RStudio needs R to work).
- Open RStudio and create a new project via File > New Project (this creates an
.Rprojfile that keeps your working directory, history, and settings together). - Verify your setup by running
R.version.stringin the R console.