The R Projects consist of html files with the output from running R scripts in RStudio. Using a web browser, these files detail various applications of R in the course.
Interested readers may download the compressed (zipped) folders and replicate the R / RStudio computations on their own computer.
The following instructions apply to executing R scripts in the first R Project. For all other R Projects, follow the same instructions (skipping step 1) replacing “rproject1.zip” with the corresponding compressed (zipped) folder for that project.
- Download / Install R and the Rstudio desktop on your computer
http://www.rstudio.com/products/rstudio/download/
- Download the compressed folder for the R Project (“rproject1.zip” for Project 1) to your computer and extract the project directory, e.g., “rproject1” (for Project 1).
- Start the R-Studio application. From the top bar of commands
- select “File”, then “New Project …”, then for the “Create Project from” option select “Create Project from Existing Directory”
- with the browser that appears, navigate to select the extracted directory “rproject1” (for Project 1, or “rproject2” for Project 2, etc.)
- The R-Studio application opens with a 4-panel display. The lower left panel is a console for typing R commands directly or viewing output from executed R commands. The lower right panel has tabs [Files|Plots|Packages|Help]. In the lower right panel, select the Files tab and open one of the R Script files, e.g., for Project 1 select the file “Rproject1_script1.r” by clicking on the file name. The file will open in new tab in the top left panel.
- Go to the file in the top left panel: Rproject1_script1.r. Execute the script file by either pressing the “Source” button at the top tool bar of the file window, or highlighting commands in the file and typing Control-Enter or Control-r. The html file in the project directory can be re-created (compiled) by pressing the “notebook” icon at the middle of the top bar of the top-left script window. The html file is easily viewed in a web browser and documents the R commands and output from executing the R script.
- To exit R-Studio, either type: q() # at the console, or select “File / Quit R” from the Tool Bar at the top of R-Studio. (It asks you to type “n” or “y” to not-save or save the workspace “.RData”. You can type “n” since the scripts are designed to load relevant R workspaces explicitly; typing “y” will save any objects you might have created in the R workspace.)
Note: When you restart R-Studio, the application should open automatically with the same panel of open files.
SES # | PROJECT HTML FILES | R FILES |
---|---|---|
L1 | R Project 1: Distributions Derived from the Normal Distribution | R Project 1 (ZIP) (This file contains: 1 .r file.) |
L5 |
R Project 2: LeCam-Neyman Precipitation Data (MOM Estimation of Gamma) |
R Project 2 (ZIP) (This file contains: 2 .r files.) |
L6 |
R Project 3: Hardy Weinberg Model / Rayleigh Distributions Maximum Likelihood Estimates of Multinomial Cell Probabilities |
R Project 3 (ZIP) (This file contains: 3 .r files.) |
L8 |
R Project 4: Bayesian Estimation |
R Project 4 (ZIP) (This file contains: 2 .r files.) |
L9 | R Project 5 (ZIP) (This file contains: 4 .r files.) | |
L10 |
R Project 6: Hypothesis Testing II |
R Project 6 (ZIP) (This file contains: 2 .r files.) |
L11 |
R Project 7: Assessing Goodness of Fit |
R Project 7 (ZIP) (This file contains: 6 .r files.) |
L13 |
R Project 8: Summarizing Data |
R Project 8 (ZIP) (This file contains: 5 .r files.) |
L14 |
R Project 9: Regression Analysis of CAPM |
R Project 9 (ZIP) (This file contains: 2 .r files.) |
L15 |
R Project 10: Polynomial Regressions and Weighted Regressions |
R Project 10 (ZIP) (This file contains: 3 .r files.) |
L16 |
R Project 11: Multiple Comparisons and ANOVA |
R Project 11 (ZIP) (This file contains: 2 .r files.) |
L17 | R Project 12 (ZIP) (This file contains: 2 .r files.) |