We are going to try the first three questions of Case Study 1 today. But first, we need to make sure you are set up with a nice directory to work in that saves your R work in a place that you can readily find (and a place that is regularly backed up).
A. Open R-studio and type getwd() at the command line of the console. This is one of a few Unix commands that we have to learn just to put files where we want them. You probably get something like
"C:/Users/rjcunnin/Documents"
If you were to start working in R right now, any documents you produce will appear in this directory by default and there is lots of other junk there so we want a nice place to keep just our VERY important STOR 455 stuff. Whereever you are, you can make a subdirectory called “STOR 455 R Projects” using the command
dir.create("STOR 455 R Projects")
Now you can view this directory by typing dir() and you can set it as your working directory by typing
setwd("STOR 455 R Projects")
It will be fine for you to do all of your work in this directory as long as your computer is backed up regularly. If your computer is not automatically backed up regularly, you will want to back up this file EVERY DAY to Dropbox, Google Drive or something similar.
However, it is safer and much more professional to use a working directory that is actually housed somewhere other than on your machine. I use Dropbox or Google-drive for this. Both are free as long as you don’t fill them up too much with pictures, movies, etc. One of the IA’s or I can show you how to do this but we’ll use your machine directory today.
If you have a strong preference to work alone, that’s ok but be aware that the Case Study is designed to be vague enough that you will benefit greatly from a partner.
Get Case_Study_1 and put it into your working directory and open it from R.
This will give you a readable version of the Case Study. Please recognize the awesomeness of R-Studio that lets you publish a nice HTML document from the R-Markdown file. You will master this easy process at a later date.
I will demonstrate the very first step if necessary.
We need to practice this. First, you need to save the R-markdown file you are using as “yourname CaseStudy1”. So mine looks like “Robin Cunningham CaseStudy1”.
Then hit ‘Knit HTML’ one more time to produce an html document with the same name. Both files will be in your working directory. Before handing your homework in on Sakai, you need to zip the files into a single zip file