This repository acts as a companion for the R programming portion of the Software Carpentry Workshop being held at University of Arizona.
Every adventure starts with getting the supplies you need. To prepare for the R portion of the workshop, you'll need to get the data we'll be using and some fancy addons to R!
There are two ways to do this, the first using the command line.
- In your Terminal (Mac) or Git Bash (Windows), type
cd
and pressEnter
. This takes you back to your home directory, thencd
(change directory) into theSDC_workshop_20170826
directory. - On the main page of the repo, click the word Fork at the top right of the page. This will copy the repo into your GitHub account.
- You should now be in your own
intro-r-20170825
repo. Click the green button that says Clone or download. - Click the copy to clipboard button that is next to the URL
- Back in your terminal, type
git clone URL
where the URL is the what is in your clipboard. - Check your work by using
ls
to verify that there is now a folder calledintro-r-20170825
in your home directory. - Copy the
gapminder.txt
file you created intointro-r-20180825/datasets/
. If you have any trouble, there is a backup for this, calledgapminder_backup.txt
.
- Open R Studio. You should see a box labelled
Console
, and there should be a>
at the beginning of the line where you can type. Typegetwd()
andEnter
to find your HOME directory. Teaser: This is the R equivalent ofpwd
in Unix. - On the main page of the repo, click the word Fork at the top right of the page. This will copy the repo into your GitHub account.
- You should now be in your own
intro-r-20170825
repo. Click the green button that says Clone or download. - Click the Download Zip link and download the file.
- Unzip the downloaded archive into
HOME/SDC_workshop_20170826
(you identified HOME in step 1). - Check your work by going to
HOME/SDC_workshop_20170826
and verifying there is now a folder calledintro-r-20170825-master
there. You may want to rename itintro-r-20170825
. Inside this folder, you should see multiple folders. - Copy the
gapminder.txt
file you created intointro-r-20180825/datasets/
. If you have any trouble, there is a backup for this, calledgapminder_backup.txt
.
Open RStudio and run the following lines of code in the box labelled Console
. You should see a >
at the beginning of the line where you can type. This installs additional functionality to R so that we can do all sorts of cool stuff! Note: When you press Enter
after putting in this command, it's going to take 3-6 minutes to install everything. Your patience will be rewarded.
install.packages(c("knitr", "scales", "ggthemes", "tidyverse", "readxl"))
What did I just install? You just added some great functionality to R. These are called packages, and they work like addons or plugins. knitr
will allow you to create reports that are human readable and pretty that you can share with your boss, your parents, your dog...anyone. tidyverse
is a suite of packages that use more human readable code to import and manipulate data in R. readxl
lets you read in excel files, and while we won't cover it in this course, it's really useful and you should have it installed! scales
and ggthemes
are two packages that add features to a plotting package that was downloaded as part of the tidyverse
package, called ggplot2
. ggthemes
adds color palettes and visual options, while scales
allows us to customize a plot's axes more.
- Day 1 Part 1: First baby steps
- Day 1 Part 2: Reporting and working through problems
- Day 2 Part 3: Automating the automatron
- Day 2 Part 4: Making pretties
- Day 2 Part 5: Sharing is caring
- How to start a git repo in RStudio
- How to push that repo to GitHub
- The magic of R Notebooks
- Day 2 Part 6: Become a Jedi Master (or at least get more experience in writing R code & sharing on GitHub )
- Create an R Notebook
- More advanced loops
- More advanced plots
- Get it all up onto GitHub
- GitHub Pages so everyone can see your work
If you want more help, check out the resource list.
Elizabeth Bowman Github Research Lab I am a graduate student in.