Joseph Stover, PHD

Gonzaga University Logo

Getting R statistical software

"Here are instructions for getting R statistical software up and running.


Posit Cloud:

I strongly suggest getting an account on Posit Cloud (this is the company that makes RStudio). Then you have access to a fully-capable and up-to-date version of R and RStudio form any web browser on any device. Go to: https://posit.cloud/, and sign up. Their free account simply has computation time limitations, which, as of 1/18/2023, is 25 hours per month and should be sufficient for a student. 

Alternatively, you can download and install R and RStudio Desktop locally on your computer. I recommend doing this, especially if you are more serious about learning R or running programs that require more computation time.


Downloading and installing R statistical software:

I recommend two things: 
     (1) Install R. This is the actual statistical software. 
     (2) Install RStudio Desktop. This is a nicer user interface for R.

*Note that the actual software version numbers change frequently. As of 1/18/2023 it is R 4.2.2 and RStudio Desktop 2022.12.0+353.

Getting R:

First, download the appropriate version (Windows, Mac, etc.) of R from here: https://ftp.osuosl.org/pub/cran/
  • For Windows: 
    Click on "Download R for Windows", 
    then click on "install R for the first time", 
    then click on "Download R-4.2.2 for Windows". 
    Then install the software.
  • For Mac OS: 
    Click on "Download R for macOS", 
    then click on either "R-4.2.2-arm64.pkg" or "R-4.2.2.pkg" (depending on macOS version and processor type). 
    Then install the software.
I am more proficient at Windows than Mac, but if you have trouble installing it, come see me and I should be able to help you get it figured out. There are also Linux/Unix options---I am familiar with Ubuntu and so should be able to help on those platforms as well. 

Getting RStudio Desktop:

After you have R installed, I recommend installing RStudio Desktop in order to have access to a more friendly user interface. I will always be using RStudio when I show demonstrations in class. Simply go here: https://posit.co/download/rstudio-desktop/#download and choose your desired version. The webpage should automatically detect your operating system and provide you with a link to the correct version of RStudio. You can scroll down the page and see links to various versions though. For Windows, the first link should work: "Windows 10/11 RSTUDIO-2022.12.0-353.EXE". For MacOS the second link should work: "macOS 11+ RSTUDIO-2022.12.0-353.DMG". Install the software. Done! There is also a link for older versions of RStudio in case you have an older version of Windows, MacOS, or Linux, etc.


Brief test of R & RStudio:

  1. Launch RStudio Desktop or open a Posit Cloud Workspace/Project.
  2. Locate the "Console" subwindow. This is where we will type our commands.
  3. Type "> x=1" (without quotation marks, and the ">" symbol is provided here to indicate the command prompt). This will save the value of 1 for the variable x.
  4. Type "> y=2".
  5. Type "> x+y".
  6. You should see the output "[1] 3". This indicates that the result is "3". The "[1]" indicates that the output is a single number.
Later on we will learn many interesting commands that are useful. Now you know how to open RStudio and use it as a calculator! 

Using R online through other sources:

Another option for using R statistical software is to use one of the many places online where you can use it through a web browser. There are many such websites. 

Here is one website where you can conveniently evaluate R code online from a web browser in any device: https://rdrr.io/snippets/

Another option for having quick access to R (and this is useful for a smartphone) is SageCell at: https://sagecell.sagemath.org/. This website can be used to evaluate commands from a variety of programming languages (including MATLAB and Python). Just select R from the language tab at the lower right of the textbox. If you are familiar with MATLAB, choose the option "Octave". Octave is basically an open source version of MATLAB and you can run MATLAB code using the Octave language option on SageCell.