Skip to content

Latest commit

 

History

History
156 lines (104 loc) · 4.52 KB

cm901-software-install.md

File metadata and controls

156 lines (104 loc) · 4.52 KB

install software


Computer Code Fabric by Colleen Greene is licensed under CC BY-NC-SA 2.0

contents

install R and RStudio
install git
create a library for packages
test the installation

install R and RStudio

Windows users may have to login as an Administrator (localmgr) before installing the software.

If you already have R and RStudio installed, please update to the most recent releases and update your R packages as well.

If you need additional assistance for Mac OS or Linux, these links might be useful


▲ top of page

install git

Git is version control software you install on your machine. Once installed, we access its functionality via the RStudio interface. Jenny Bryan provided these installation instructions for a workshop I attended. I suggest you read all the instructions before starting.

Optional reading: Read sections 1 and 2 of Excuse me, do you have a moment to talk about version control? for a good introduction to version control.


▲ top of page

create a library for packages

Packages are like “apps” for R. As Hadley Wickham (2014) states, “Packages are the fundamental units of reproducible R code. They include reusable functions, the documentation that describes how to use them, and sample data.”

If we store packages in a library separate from the base R installation, then when you update R, you don’t have to reinstall every package, saving a lot of time.

At the top level of your drive, create a new directory (folder) named “R”. In that directory create a new folder named “library”, for example,

  • Windows: C:/R/library
  • Linux: ~/R/library


▲ top of page

test the installation

Here we perform some simple checks to determine if the initial software installation is successful. If the test is unsuccessful, don’t panic—we’ll have some time in lab to make things work.

  • Launch RStudio

A window should open that looks something like this.

You can type R code in the Console pane, and press Enter to run it. For example,

  • in the Console type 2 + 7
  • press Enter to obtain the result
#> [1] 9

We can draw a simple graph that should appear in the Plots pane.

  • one line at a time, type the following lines and press Enter
t <- seq(from = 1, to = 6*pi, by = pi/16)
y <- sin(t)
plot(t, y)

Lastly, let’s check if RStudio can see git locally. In RStudio,

  • Tools > Terminal > Move Focus To Terminal
  • In the terminal pane, type
git --version 

If RStudio is aware of your git installation, you should see a response in the terminal something like this

git version 2.17.0.windows.1

If not, no worries. We’ll take care of it in lab.

references

Wickham H (2014) Advanced R. CRC Press, Taylor & Francis Group, Boca Raton, FL http://adv-r.had.co.nz/

Wickham H and Grolemund G (2017) R for Data Science. O’Reilly Media, Inc., Sebastopol, CA https://r4ds.had.co.nz/


▲ top of page
◁ calendar
◁ index