Section 10 Getting the Software
Everything is free, but it does require some patience to get control over your computer.
10.1 In brief, what will I need to do for 431?
These instructions are also available on the main course website.
- Download and install the latest version of R (version 4.0.2 or later) from http://cran.case.edu/ or, if you prefer, from https://cloud.r-project.org which automatically chooses a fast, nearby mirror for you.
- If you have a pre-existing installation of R and/or RStudio, we highly recommend that you reinstall both to get current.
- Download and install RStudio Desktop (Open Source Edition - the free version 1.3.1056 or later) at https://www.rstudio.com/products/rstudio/download/#download.
- If you prefer, you can instead install RStudio’s Preview Version to get the very latest features, but that requires you to update your setup more frequently, and occasionally deal with some additional troubleshooting.
- Dr. Love will stick with the regular open source version in his work for 431.
- Install some R packages - an R “package” is a collection of functions, data, and documentation that extends the capabilities of R, and is the critical way to get R doing interesting work.
- A list of initial R Packages to install is provided below, along with instructions. A more complete list of packages will be maintained on the main course website.
- When available, you will download some data and code (functions) we’ve developed specifically for 431.
- This information will be provided on the main course website.
- Obtain a free Github User Account by visiting https://github.com/ and signing up.
- We urge you to select a Github username that identifies you effectively, and that matches your other professional social media usernames. For instance, Dr. Love uses THOMASELOVE on Github and @thomaselove on Twitter.
10.2 Initial R Packages to Install
An R “package” is a collection of functions, data, and documentation that extends the capabilities of R, and is the critical way to get R doing interesting work. These package instructions should be used after you’ve installed R and RStudio.
- Open RStudio. Copy and paste the following lines of code into the Console window of RStudio to install a few key packages.
pkgs <- c( "arm", "boot", "devtools", "Epi", "fivethirtyeight",
"gapminder", "here", "Hmisc", "infer", "janitor",
"knitr", "magrittr", "markdown", "mosaic", "naniar",
"NHANES", "patchwork", "rmarkdown", "rms", "tableone",
"tidymodels", "tidyverse" )
install.packages(pkgs)
Execute those commands by hitting Enter.
Now, go to the Packages tab on the right side of your RStudio screen, and click on Update.
This will bring up a dialog box. I usually click Select All, then click Install Updates.
- A popup box may appear, asking “Do you want to install from sources the packages which need compilation?” to which I usually answer No. A Yes response leads to a slower installation, but can solve problems if you still have them after updating.
- This may take a few minutes. As long as you’re seeing activity in the Console window, things are progressing.
- Eventually, you’ll get a message that “The downloaded source packages are in …” with a directory name. That’s the sign that the updating is done.
- Updating packages is something you’ll do occasionally throughout the semester, mostly when a problem happens.
- Finally, choose File … Quit Session from the top menu, and accept RStudio’s request to save your workspace. This will eliminate the need to re-do these steps every time you work in R.
10.2.1 Note: A Windows Issue
If you are using Windows, and get messages during installation that the latest version of RTools needs to be installed, you can usually just ignore them. If you don’t want to ignore them, go here to download and install RTools for Windows.
10.3 Installing a Single Package
If you want to install a single package, you can do so by finding the word Packages on the right side of your RStudio screen.
- Click on the Packages tab to start installing the packages you’ll need.
- Click Install, which will bring up a dialog box, where you can type in the names of the packages that you need. These should be separated by a space or comma. Be sure to leave the Install dependencies box checked.
- A popup box may appear, asking “Do you want to install from sources the packages which need compilation?” to which I usually answer No. A Yes response leads to a slower installation, but can solve problems if you still have them after updating.
- This may take a few minutes. As long as you’re seeing activity in the Console window, things are progressing.
- Eventually, you’ll get a message that “The downloaded source packages are in …” with a directory name. That’s the sign that the updating is done.
10.4 Need Installation Help?
If you need more help, you might look at this terrific resource for Installing R and RStudio from Jenny Bryan and the STAT 545 project. These are the people responsible for the great Happy Git with R project, which will also be worth your time when we are using Git and GitHub.
- If you’re having trouble with installation before our first class, don’t worry too much. The TAs and Dr. Love will be available to help once the class gets going.
- If you’re having installation problems or problems getting started in R, please consider visiting TA office hours or perhaps asking a question on Piazza. We want to hear from you!