1 Steps to download R Studio
This guide will walk you through downloading and installing R and RStudio on your computer.
Important: You must install R first, then RStudio. RStudio does not include R - they are separate programs.
1.1 Installation on World Bank Machines
If you are using a World Bank managed computer, follow these simplified steps:
1.1.1 Windows (World Bank Machines)
- Open Software Center from your Start menu
- Search for “R” and install R for Windows
- Search for “RStudio” and install RStudio Desktop
- Both applications should install automatically through the Software Center
1.1.2 Mac (World Bank Machines)
- Open Self Service from your Applications folder or dock
- Search for “R” and download/install R for Mac
- Search for “RStudio” and download/install RStudio Desktop
- Both applications should install automatically through Self Service
1.1.3 After Installation on World Bank Machines
- R and RStudio should now be available in your Applications (Mac) or Start Menu (Windows)
- Proceed to Step 3: Verify Installation below
1.2 Installation on Personal Computers
If you are installing on your personal computer, follow these detailed steps:
1.3 Step 1: Download and Install R
R is the programming language itself - you need this first!
R is the programming language, and you need to install it first before RStudio.
- Go to the official R website: https://www.r-project.org/
- Click on “CRAN” (Comprehensive R Archive Network)
- Choose a mirror location close to you
- Select your operating system:
- Windows: Click “Download R for Windows” → “base” → Download the latest version
- Mac: Click “Download R for (Mac) OS X” → Download the latest .pkg file
- Linux: Follow the instructions for your specific distribution
- Run the downloaded installer and follow the installation prompts
1.4 Step 2: Download and Install RStudio
RStudio is the user-friendly interface for R - install this after R is installed.
RStudio is the integrated development environment (IDE) that makes working with R much easier. RStudio requires R to be installed first - it does not include R.
- Go to the RStudio website: https://posit.co/downloads/
- Scroll down to “RStudio Desktop”
- Click “Download RStudio Desktop”
- The website should automatically detect your operating system
- Download the installer for your system
- Run the installer and follow the setup instructions
1.5 Step 3: Verify Installation
- Open RStudio (not just R)
- You should see a interface with multiple panes
- In the Console pane (usually bottom-left), type:
R.version.string - Press Enter - you should see your R version information
- Try running a simple command:
2 + 2
1.6 Step 4: Install Required Packages
For the nighttime lights training, you’ll need several R packages. Copy and paste this code into the RStudio console:
# Install required packages for nighttime lights analysis
install.packages(c(
"tidyverse",
"sf",
"terra",
"leaflet",
"blackmarbler",
"geodata",
"osmdata",
"exactextractr",
"here"
))1.7 Troubleshooting
1.7.1 Common Issues:
R is not found when installing RStudio: - Make sure you installed R first before RStudio - Restart your computer after installing R
Package installation errors: - Try installing packages one at a time if the bulk installation fails - On Windows, you may need to install Rtools: https://cran.r-project.org/bin/windows/Rtools/
Permission errors on Mac: - You may need to allow the installer in System Preferences → Security & Privacy
1.7.2 Getting Help:
- RStudio Community: https://community.rstudio.com/
- R Help documentation: Type
?function_namein the console for help on specific functions - Stack Overflow R questions: https://stackoverflow.com/questions/tagged/r
1.8 Next Steps
Once you have R and RStudio installed, you’re ready to begin the nighttime lights training materials!