Installing R on Windows 11

I was working on a machine learning project and needed to use R. R is a library of thousands of classical statistics functions plus a scripting language. My company’s IT department upgraded one of my laptops from Windows 10 to Windows 11 so I figured I’d install R on the laptop. Bottom line: there were no problems installing R on my Windows 11 machine.

I did an Internet search for “install R on Windows” and was directed to https://cran.r-project.org/bin/windows/base/. The current version at the time was R-4.1.3 and so I clicked on the “Download R 4.1.3 for Windows link and then saved the R-4.1.3-win.exe installer file on my Desktop.

I double-clicked on the installer executable. I specified English as the language. I got the License agreement and clicked Next. I accepted the default installation location of the C:\Program Files\R\R-4.1.3 directory.

On the next four screens, I accepted the default options for Components, Startup Options, Start Menu Folder, Additional Tasks. The “Installing” screen with its green progress bar appeared and installation finished in about 3 minutes. I clicked on the Finish button.

I created a “Hello World R” script to test the installation. I opened a File Explorer window and navigated to the R files at C:\Program Files\R\R-4.1.3\bin\x64. I double-clicked on the Rgui.exe file to launch the combined R console shell and script editor.

I clicked on File | New Script option to launch the editor (basically Notepad). I typed this code into the editor:

# hello.R
# R 4.1.1

cat("\nBegin example \n\n")

x <- 1.1
y <- as.integer(2)
z <- x + y

cat("Sum of 1.1 and 2 is", z, "\n\n")

cat("End demo \n\n")

I clicked on File | Save As and saved the script at a C:\R directory as hello.R.

I switched over the the Console window and typed CTRL-L to clear the display. Then to run the program I entered:

setwd("C:\\R")
rm(list=ls())
source("hello.R")

The rm(list=ls()) removes all current objects in memory. The source() function runs the program.

Good fun.



Incredible what the digits 0 to 9 can create.


This entry was posted in R Language. Bookmark the permalink.