How to open and use R script files in RStudio Cloud

Video guideline:

Make sure you have a RStudio Cloud account. Otherwise, get one and install all the packages. See this guideline.

Textual guideline:

  1. Open RStudio Cloud website and log in. Click "RStudio labs" under "Your content."

  2. Download the R script file you need:

    1. Go to Canvas Resources module page “Lab resources” “All R script files” Click on the R Script file you need and download that file. “All script files” is here for your convenience.

    2. For example, if you need the "Descriptive Statistics" R script file. Click on it and download:

  1. Uploading R script files 1: On RStudio Cloud website, click “Upload” (see highlighted part #2 below).

  1. Uploading R script files 2: Click “Choose File.” Find the R script file you just downloaded (script_descriptive.R) in the previous step, click “Open” and "OK."

  1. Opening R script files: The file is uploaded and at the bottom of the "Files" list (see highlighted part #1). When you click on it, the descriptive R script file will open (see highlighted part #2).

  1. Installing and loading packages: Whenever we open RStudio, we highlight all the lines under the “Install and load packages” (see highlighted part #1) and click run (see highlighted part #2).

  1. Loading data: When the process of installing and loading packages is completed, we highlight all the lines under the “Load data” (see highlighted part #1) and click “Run” (see highlighted part #2). When you see “gss” and “key” (see highlighted part #3), it means we successfully installed and loaded the packages, and loaded the GSS data.

  1. Running the analysis codes: We highlight the codes (see highlighted part #1) and click “Run” (see highlighted part #2). Clicking “Run” generates the analysis (see highlighted part #3).

  1. Using R script files - “working space” and outline view: We do not edit or change anything on R script files except under “working space”(see highlighted part #1). Anything above the “working space” is teaching material!

    The codes for assignments will be put under the “working space”

    For easy navigation click “Outline” (see highlighted part #2) to see the headings and subheadings.

  1. Saving R script files: When we make any changes, the font of the file name (shown in the highlighted part #2 above) will be red with an asterisk (*) - (see the highlighted part #1 below). To save our progress, we click save (see the highlighted part #2 below)

Last updated