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)

1.2: Install RStudio (IDE)

You now have R and RStudio ready.

1.3: Launch and Verify

>
version

If R prints its version information, the installation is successful.

Step 2: Create a New RStudio Project

Everything you do (scripts, data, plots) will stay inside this folder. This keeps your analysis organized and reproducible.

Step 3: Initialize a Project Environment with renv

>
install.packages("renv")
>
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:

>
install.packages(c("ggplot2", "dplyr", "readr"))

These packages are installed only within this project environment.

Optional: If your analysis requires additional statistical measures (for example, Fisher / excess kurtosis), you may need to install extra packages such as 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


library(ggplot2)
library(dplyr)
library(readr)

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()
You now have a fully reproducible environment.