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 installing R.
- Create an RStudio Project to keep the working directory, history, and settings 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 R (or RStudio) and typing
R.version.stringin the Console.
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.
Key points
- Install R from a CRAN mirror before installing RStudio Desktop.
- Type
R.version.stringin the R or RStudio Console to verify the installation. - Create an RStudio Project to keep the working directory and settings together.
Next: Variables in R