R Installation Guide in Windows 11
This guide explains how to install R and RStudio on Windows 11 operating system.
Step 1: Standard Installation (via CRAN)
1.1: Install R (Core Language)
- Go to: https://cran.rstudio.com/bin/windows/base/
- Click Download R for Windows
- Download and install R
- Accept the default settings (recommended for beginners)
1.2: Install RStudio (IDE)
- Go to: https://posit.co/download/rstudio-desktop/
- Download RStudio Desktop for Windows
- Install RStudio
- Open RStudio — it will automatically detect R
1.3: Launch and Verify
- Open RStudio
- In the Console, type:
version
If R prints its version information, the installation is successful.
Step 2: Create a New RStudio Project
- Open RStudio
- Click File → New Project → New Directory → New Project
- Enter a project name (e.g.,
stats) - Choose a folder location
- Click Create Project
Step 3: Initialize a Project Environment with renv
- Open the Console tab in RStudio
- Install
renv(only once):
install.packages("renv")
- Initialize the project environment:
renv::init()
This creates a project-specific package library and a
renv.lock file that tracks package versions.
Step 4: Install Required Packages
For general data analysis, install the following packages:
- ggplot2 — plotting
- dplyr — data manipulation
- readr — reading CSV files
install.packages(c("ggplot2", "dplyr", "readr"))
These packages are installed only within this project environment.
e1071, only one package, so no c() needed. c() means, combine or concatenate.
install.packages("e1071")
The kurtosis() function in e1071 computes
Fisher (excess) kurtosis, where a normal distribution
has a value of 0.
Pearson kurtosis is the original definition, where a normal
distribution equals 3.
Use Fisher/excess kurtosis for easier interpretation.
Step 5: Load Packages in Your Script
- Click File → New File → R Script
- Add the following at the top of your script:
library(ggplot2)
library(dplyr)
library(readr)
- Save the script (File → Save or Ctrl+S / Cmd+S)
- Click Source (top right of the script editor)
- This runs the entire script from top to bottom, loading all packages at once
Step 6: Save Your Environment Snapshot
After installing packages and working on your analysis, type the following in the RStudio Console:
renv::snapshot()
This locks package versions. Anyone you share the project with can run:
renv::restore()