R for Novice Programmers (1e) (2024)

2.1 Questions

  • How does one install R and RStudio on their personal computer?

  • Can RStudio be used online via a cloud-based service?

  • Is it possible to work with alternative code editors when using R?

  • What steps are involved in installing RStudio?

2.2 Learning Objectives

  • Install the R programming language on your local machine.

  • Install RStudio as an integrated development environment (IDE) for R on your local machine.

  • Create an RStudio Cloud Account on the Posit Website.

  • Learn how to use alternative code editors.

2.3 Lesson Content

2.3.1 Introduction

Both the R and RStudio software are required to make full use of the R programming environment. R is the programming language, while RStudio is the integrated development environment (IDE) that has an easy-to-use interface. Here, we will focus on downloading R and RStudio for Windows from the respective websites. The instructions for downloading these two programs on Mac/Linux operating systems are available on the download websites.

2.3.2 Install R

To install R on your personal computer, visit the R Project for Statistical Computing’s Comprehensive R Archive Network CRAN. Follow the illustrated steps shown below:

2.3.2.1 Step 1

On the CRAN homepage, select the appropriate version of R for your operating system (Linux, macOS, or Windows; see Figurefig-cran-1).

R for Novice Programmers (1e) (1)

2.3.2.2 Step 2

If installing R for the 1st time, click on “base” (Figurefig-cran-2).

R for Novice Programmers (1e) (2)

2.3.2.3 Step 3

Click on the “Download” link for the latest version of R that is currently available (at the time of this writing, it was R-4.3.2). Once downloaded, run the executable file and wait for the software to be installed (Figurefig-cran-3).

R for Novice Programmers (1e) (3)

2.3.2.4 Step 4

Once R is installed, open up the R software. The R graphical user interface should be similar to what is depicted below (Figurefig-r-console-1).

R for Novice Programmers (1e) (4)

2.3.3 Install RStudio

The RStudio IDE can be obtained from the “Download” section of the Posit website. Install the software by clicking on the “Download RStudio Desktop for Windows” button and running the downloaded program (Figurefig-rstudio-1).

R for Novice Programmers (1e) (5)

Once installed, verify that the RStudio software has a similar graphical user interface to the one depicted in the image below (Figurefig-rstudio-console-1).

R for Novice Programmers (1e) (6)

2.3.4 Create an RStudio Cloud Account on the Posit website

Posit (formerly RStudio) Cloud lets the user access the RStudio interface from their internet browsers (Figurefig-r-cloud-1). Using this option does not require any installation or specific software configuration to be implemented. Posit Cloud offers a free plan for casual users (without the need for a paid plan) and there is no need for dedicated hardware. Additionally, Posit provides a comprehensive guide for first-time users.

2.3.4.1 Step 1

Access the Posit Cloud Website (Figurefig-r-cloud-1).

R for Novice Programmers (1e) (7)

2.3.4.2 Step 2

Sign up for a new user account (Figurefig-r-cloud-2).

R for Novice Programmers (1e) (8)

2.3.4.3 Step 3

Log in to the new account, and you should see the page shown below (Figurefig-r-cloud-3). It includes the workspace where all projects will be hosted. On the top right-hand side of the website is a button that allows one to create a “New Project.” Additionally, the “Learn” and “Help” sections on the left panel can assist with troubleshooting.

R for Novice Programmers (1e) (9)

2.3.4.4 Step 4

Create an R script to allow for code editing (Figurefig-r-cloud-console-1).

R for Novice Programmers (1e) (10)

2.3.5 Using alternative code editors to work with R (Advanced Users)

Visual Studio (VS) Code is a code editor that can be used with various programming languages. For users that have previous experience with this code editor and would like to use it when reading this book, it is possible to use VS Code as an alternative to RStudio. After installing R, the “R Extension for Visual Studio Code” can be installed in the “Extensions” menu (Figurefig-r-vscode).

R for Novice Programmers (1e) (11)

2.4 Exercises

  1. Download and install R and RStudio (If you have not already done so).
  2. Describe the steps involved in installing R on a Windows operating system.
  3. Are there any specific considerations when installing R on a macOS or Linux system?
  4. Set up a free RStudio Cloud Account on the Posit Website.
  5. Compare the local RStudio with the cloud-based RStudio and list the potential benefits/disadvantages of both.
  6. Verify your R installation by running a simple R script that prints “Hello, R! My name is (fill in the blank)” to the console.
  7. Can you customize the appearance or behavior of RStudio according to your preferences?

2.5 Summary

In this chapter, we have provided a step-by-step guide for downloading R and RStudio on the learner’s personal computer. Additionally, the learner has been shown how to set up an RStudio Cloud account on the Posit website, which allows for the use of R/RStudio using a web-based browser. Lastly, the learner has been shown how to access R/RStudio using alternative code editors such as Visual Studio Code. Overall, having a functional R and RStudio environment is key to gaining the most out of your learning journey. In the next chapter, we will navigate the R/RStudio interfaces and explain the various panes and menu options.

R for Novice Programmers (1e) (2024)

References

Top Articles
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 6171

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.