How to Install R and RStudio on Windows 11

R is a powerful programming language for statistical computing and data visualization. RStudio is an integrated development environment (IDE) for R, making it easier to write, debug, and manage R scripts. This guide walks you through the steps of installing R and RStudio on Windows 11.

YouTube Video

Step 1: Download and Install R

  1. Visit the R Project Website:
    Open your browser and go to https://cran.r-project.org/.

  2. Choose a CRAN Mirror:
    Click on a CRAN mirror close to your location (e.g., "0-Cloud [https]").

  3. Download the Windows Installer:

    • Click on Download R for Windows.
    • On the next page, click base under "Subdirectories".
    • Click Download R x.x.x for Windows to download the .exe file.
  4. Run the Installer:

    • Locate the downloaded file (e.g., R-x.x.x-win.exe) in your Downloads folder and double-click it.
  5. Install R:

    • Language: Choose your preferred language and click OK.
    • Setup Wizard: Follow the on-screen instructions:
      • Accept the license agreement.
      • Choose the installation path (default: C:\Program Files\R\R-x.x.x).
      • Select components (leave the defaults checked).
    • Click Finish to complete the installation.

Step 2: Verify R Installation

  1. Open the Start Menu and search for R x64 x.x.x.
  2. Launch R and ensure it opens successfully.
  3. Test R by typing:
    version
    
    • This will display the installed R version details.

Step 3: Download and Install RStudio

  1. Visit the RStudio Website:
    Go to https://posit.co/download/rstudio-desktop/.

  2. Download RStudio:

    • Under RStudio Desktop Open Source License, click the Download button for Windows.
    • The .exe file (e.g., RStudio-x.x.x.exe) will start downloading.
  3. Run the Installer:

    • Locate the downloaded file in your Downloads folder and double-click it.
    • Follow the installation wizard:
      • Accept the license agreement.
      • Choose the installation path (default: C:\Program Files\RStudio).
    • Click Install and then Finish to complete the setup.

Step 4: Verify RStudio Installation

  1. Open the Start Menu and search for RStudio.
  2. Launch RStudio.
  3. RStudio should automatically detect your R installation.
    • To confirm, go to Tools > Global Options in RStudio and check the R version under the General tab.

Step 5: Test RStudio

  1. In the Console pane of RStudio, type the following command:
    print("R and RStudio are working!")
    
  2. Press Enter.
  3. If everything is set up correctly, the message will be displayed in the console.

Optional: Install R Packages

To enhance R’s functionality, install additional packages:

  1. Open RStudio.
  2. In the console, type:
    install.packages("ggplot2")
    
  3. Press Enter to install the ggplot2 package.
  4. Once installed, load the package:
    library(ggplot2)

Conclusion

You’ve successfully installed R and RStudio on Windows 11. With this setup, you’re ready to explore data analysis, statistical modeling, and visualization. RStudio provides a user-friendly interface that simplifies working with R, making it a great choice for beginners and advanced users alike. Happy coding and data analysis!

Continue Learning with Java Guides

Want to take your programming skills to the next level? Explore my practical Udemy courses on Java, Spring Boot, Microservices, Full-Stack Development, Docker, and Generative AI. You can also follow my structured learning roadmaps to become a professional developer.

By Ramesh Fadatare - Udemy Instructor Partner

Comments