STOR 455 Section 1 (Cunningham)

August 30, 2016

.

You have attempted Questions 1-5 of Case Study 1 and we have 3 goals today regarding that Case Study:

  1. Discuss and confirm your answers with another student.

  2. Get your answers into an RMarkdown version of Case Study 1 so that you can turn it in.

  3. Attempt additional questions in Case Study 1.

1. Set your Working Directory

A. Open R-studio and type getwd() at the command line. 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"

You can work in this directory if you like, but last class we made a new one called “STOR 455 R Projects”. You can move to this directory if you are not already there 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.

2. Move so you are sitting next to a fellow tarheel

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.

3. Download Case Study 1 as an .Rmd file

by right-clicking CaseStudy1.Rmd and selecting “Open in new Tab” When given the option, click the “Download” button.

  1. If you are on a PC, ‘Save File’ and open the saved file. It should open in R-Studio, but you may have to pick the application the first time. Peiyao and I can help if necessary.

  2. If you are on a Mac Find the file in your downloads and double-click it. You should be good to go.

You should now have the .Rmd file for Case Study 1. The version you worked on over the weekend was and HTML file which would have been very tedious to put answers into. RMarkdown will make this easy.

4. Click ‘Knit HTML’

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.

5. Work through Questions 1-5

The point is to discuss your answers and get them into the RMarkdown file. So answers will be entered in the appropriate lines of the RMarkdown file and then you can check your handywork by Knitting.

You can always view your work in progress by Knitting a new HTML file.

6. Submit your Work for Grading

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 and you can turn them in to the appropriate assignment in Sakai. (If you try to preview your ‘html’ document after submitting your assignment you may get an error message due to Sakai’s failings. That is NOT a problem, Weiwei is very resourceful.)