Environment Setup
Before you can write a single line of R code, you need to set up your development environment. This involves installing R itself (the language engine) and RStudio (the IDE that makes working with R dramatically easier).
1. System Requirements
| Requirement | Details |
|---|---|
| Operating System | Windows 10/11, macOS 11+, or Linux (Ubuntu 20.04+) |
| RAM | Minimum 4GB (8GB+ recommended for larger datasets) |
| Storage | At least 2GB free for R, RStudio, and packages |
| Internet | Required to download R, RStudio, and CRAN packages |
2. Installing R
Step 1: Download R
Visit cran.r-project.org and choose your operating system (Windows, macOS, or Linux).
Windows
- Click "Download R for Windows" → "base" → "Download R x.x.x for Windows".
- Run the
.exeinstaller and follow the setup wizard using default options.
macOS
- Click "Download R for macOS" and select the
.pkgfile matching your chip (Intel or Apple Silicon). - Open the package and follow the installer.
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install --no-install-recommends r-base
3. Installing RStudio Desktop
Visit posit.co/download/rstudio-desktop and download the free RStudio Desktop edition for your OS. Install it just like any regular application — RStudio will automatically detect your R installation.
4. Verifying Your Installation
Open RStudio and type the following in the Console pane, then press Enter:
print("Hello, R!")
R.version.string
You should see the greeting printed along with your installed R version, e.g. "R version 4.4.1 (2024-06-14)".
5. Installing Essential Packages
R's real power comes from its package ecosystem. Install the most commonly used packages for this course using install.packages():
install.packages("tidyverse") # dplyr, ggplot2, tidyr, readr, and more
install.packages("shiny") # interactive web apps
install.packages("rmarkdown") # dynamic reports
install.packages("caret") # machine learning workflows
install.packages("plotly") # interactive charts
Load a package into your session with library():
library(tidyverse)
6. Setting a CRAN Mirror
On first use, R may ask you to choose a CRAN mirror (download server). Choose one close to your location, or use the global cloud mirror which auto-routes you:
options(repos = c(CRAN = "https://cloud.r-project.org"))
7. Production-Ready Checklist
- ✅ Install R — Latest stable release from CRAN.
- ✅ Install RStudio Desktop — Free open-source edition.
- ✅ Verify installation — Run a test command in the Console.
- ✅ Install tidyverse — The foundation for data wrangling and visualization.
- ✅ Set a CRAN mirror — For fast, reliable package downloads.
Ready to master R Programming?
Build real-world data analysis and visualization projects with hands-on training, mentor-led sessions, and placement support.
.png)