3. Crash Course in R-Program
Why R?
Install R – free! Also available in Computer Labs if you don’t have a
labtop or it does not work.
Tons of online resources! If you are stuck, google your problem. For
example, “how do I only keep certain observations in R?”
Staubli Social Insurance U of Calgary 41 / 74
3. Install R for Windows
R for Window
Go to www.r-project.org
Click the “download R” link under “Getting Started”.
Click on “https://cloud.r-project.org/” to install from nearest server
Click on “Download R for Windows”
Click on the “install R for the frst time” link at the top of the page.
Click “Download R-4.2.2 for Windows” and save the executable fle
somewhere on your computer.
Right click on the .exe fle and select “Run as administrator,” follow the
installation instructions.
Staubli Social Insurance U of Calgary 42 / 74
3. Install R for MAC
R for MAC
Go to www.r-project.org
Click the “download R” link in the middle of the page under “Getting
Started.”
Click on “https://cloud.r-project.org/” to install from nearest server
Click on the “Download R for macOS” link at the top of the page.
Save the .pkg fle with the latest release (4.2.2), double-click it to
open, and follow the installation instructions.
Staubli Social Insurance U of Calgary 43 / 74
3. Install R Studio
Install R Studio: ideal to work with R – free!
Go to www.rstudio.com and click on “Download”.
Click the tab “Products” and click on “RStudio”
Click on “DOWNLOAD RSTUDIO” and click “DOWNLOAD
RSTUDIO” below RStudio Desktop
Scroll to “All Installers and Tarballs” and choose the fle for your
operating system.
Right-click on .exe fle (Windows) and select “Run as administrator”
(Mac: save the .dmg fle on your computer, double-click it to open,
and then drag and drop it to your applications folder.)
Staubli Social Insurance U of Calgary 44 / 74
3. Working in R Studio
Staubli Social Insurance U of Calgary 45 / 74
3. Projects and Scripts
Use a “Project” to work in R
Click on File, New Project, New Directory, New Project.
Give the directory a name, for example “CDM” and save all data, code,
etc. in that directory
R Studio will automatically search for data, scripts, etc. in your project
folder.
Use “Scripts” to save your code
Click on File, New File, R Script: Here is where you can write/save
your code (top left)
Staubli Social Insurance U of Calgary 46 / 74
3. Installing Packages and Loading Packages
Staubli Social Insurance U of Calgary 47 / 74
- Phone+44 7868 815209
- Emailadmin@solvemyproject.com
- Open Hours24x7
- Phone+44 7868 815209
- Emailadmin@solvemyproject.com
- Open Hours24x7