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 guidelinearrow-up-right.

Textual guideline:

  1. Open RStudio Cloud websitearrow-up-right 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 herearrow-up-right 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 websitearrow-up-right, 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