Introduction to R
We will be using the statistical software environment R
throughout the program’s lectures and labs. R
is an open-source programming language specifically designed for statistical computing and graphics. In addition to its vast library of built-in functions for working with data, the extensibility of R
allows statisticians and data scientists to continuously develop new packages for its community to use. This has led R
to be adopted by academic researchers and organizations across various industries.
Please follow the steps below for set-up prior to beginning the program on June 6th.
Installing R
- Open an internet browser and go to
www.r-project.org
.
- Click the download R link in the middle of the page under “Getting Started.”
- Select a CRAN location (a mirror site, preferably a location close to you) and click the corresponding link.
For Mac Users:
- Click on the “Download R for (Mac) OS X” link at the top of the page.
- Click on the file containing the latest version of
R
(which is now 4.2.0)
- Save the .pkg file, double-click it to open, and follow the installation instructions.
For Windows Users:
- Click on the “Download R for Windows” link at the top of the page.
- Click on the “install R for the first time” link at the top of the page.
- Click “Download R 4.2.0 for Windows” and save the executable file somewhere on your computer. Run the .exe file and follow the installation instructions.
Installing RStudio
Although though can use R
without it, you will need to install RStudio for summer. RStudio is by far the most popular integrated development environment (IDE) for R
. Basically, it makes your life with R
much easier and we will be using it throughout the program. To Install RStudio:
Installing tidyverse
The tidyverse
is a popular suite of R
packages we will be using throughout the summer, including the popular data visualization package ggplot2
. After installing R
and RStudio, open RStudio and proceed to enter the following command in the Console pane on the left-hand side:
install.packages("tidyverse")
Then make sure the tidyverse
suite of packages are successfully installed by running:
library(tidyverse)
If you encounter any issues or errors in any of these installation steps above, including the tidyverse
, please contact the instructors.
R
Primers on RStudio Cloud
In addition to following the steps above for installing R
and RStudio on your computer, we want you to make a free RStudio Cloud account at https://rstudio.cloud/
. This is a free, browser-based version of R
and RStudio that also provides access to a growing number of R
tutorials / primers relevant to the program this summer.
After you create a RStudio Cloud account, click on the navigation menu by “Your Workspace”. Then click on “Primers” to bring up a menu of tutorials. Please complete the following (listed in order of importance):
Feel free to explore the other primers listed, specifically for “Iterate” and “Tidy Your Data”. We will be covering data visualization extensively in the first two weeks, so you do not worry about working through the data visualization primers.
After completing the above primers available on the RStudio Cloud, try replicating the some type of R
programming basics in your own local version of R
and RStudio installed on your computer. RStudio Cloud is a great practical alternative to use in case we are unable to resolve errors with regards to installation on your own personal computer (an unlikely scenario). We strongly encourage you to use an installed version of R
and RStudio throughout the program, due to RStudio Cloud data limitations that are important for your research projects throughout the summer.
LS0tCnRpdGxlOiAiUiBCYWNrZ3JvdW5kIE1hdGVyaWFsIgpvdXRwdXQ6IGh0bWxfZG9jdW1lbnQKLS0tCgojIyBJbnRyb2R1Y3Rpb24gdG8gYFJgIAoKV2Ugd2lsbCBiZSB1c2luZyB0aGUgc3RhdGlzdGljYWwgc29mdHdhcmUgZW52aXJvbm1lbnQgYFJgIHRocm91Z2hvdXQgdGhlIHByb2dyYW0ncyBsZWN0dXJlcyBhbmQgbGFicy4gYFJgIGlzIGFuIG9wZW4tc291cmNlIHByb2dyYW1taW5nIGxhbmd1YWdlIHNwZWNpZmljYWxseSBkZXNpZ25lZCBmb3Igc3RhdGlzdGljYWwgY29tcHV0aW5nIGFuZCBncmFwaGljcy4gSW4gYWRkaXRpb24gdG8gaXRzIHZhc3QgbGlicmFyeSBvZiBidWlsdC1pbiBmdW5jdGlvbnMgZm9yIHdvcmtpbmcgd2l0aCBkYXRhLCB0aGUgZXh0ZW5zaWJpbGl0eSBvZiBgUmAgYWxsb3dzIHN0YXRpc3RpY2lhbnMgYW5kIGRhdGEgc2NpZW50aXN0cyB0byBjb250aW51b3VzbHkgZGV2ZWxvcCBuZXcgcGFja2FnZXMgZm9yIGl0cyBjb21tdW5pdHkgdG8gdXNlLiBUaGlzIGhhcyBsZWQgYFJgIHRvIGJlIGFkb3B0ZWQgYnkgYWNhZGVtaWMgcmVzZWFyY2hlcnMgYW5kIG9yZ2FuaXphdGlvbnMgYWNyb3NzIHZhcmlvdXMgaW5kdXN0cmllcy4KCl9fUGxlYXNlIGZvbGxvdyB0aGUgc3RlcHMgYmVsb3cgZm9yIHNldC11cCBwcmlvciB0byBiZWdpbm5pbmcgdGhlIHByb2dyYW0gb24gSnVuZSA2dGguX18KCiMjIyBJ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