Professional Documents
Culture Documents
ASSIGNMENT 2
PART I
http://biostat.mc.vanderbilt.edu/wiki/Main/DataSets
Diabetes data
Click on the first (html) entry for each to get the explanation of the dataset. The last link in the
row is another html entry that will give specific details on the data that you will be loading. You
do not need to download these html pages as you can just view them on the Vanderbilt sites.
You do need to download the following datasets. Put them in the working directory that you
are using for this assignment.
FIRST SET: diabetes.sav and diabetes.xls. [NOTE: two versions of same dataset]
RStudio used the readr package HOWEVER we could have used a {base} installed package
read.csv. Type this command in your console window:
>dmd2 <- read.csv(dmd.csv")
When you View(dmd2), you should have a data.frame similar to dmd already loaded.
Then type
dmd3 <- dmd
Next View(dmd3) and compare with dmd2. (as you know you can either use RStudio upper
right pane to get view of loaded data.frame or use the function View() at the console.
NOTE: why dmd is addressable may seem like magic but all will become clear in class -
although you are welcome to sort it out on your own. [HINT: it actually is in your working
environment when you do the assignment command - just hidden)
[dont bother importing the diabetes.xls - just copy it to your working directory -we will
work with this later in class]
PART II
So far you have used functions that have either are included in loaded packages (I will explain
more about this in class) OR in packages that you are not loaded but are in your library. The
way you load the packages in your library are to use the library() function. You can check on
this by looking in the packages tap in RStudio.
OK, so now what do you do if you need a package that is not in your library? Simple: you
install the package in your library (from CRAN). Here is how. - please actually install this
pack
1. At the console > type install.packages(Hmisc)
2. load(Hmisc)
3. In help look at Hmisc.overview
4. For the assignment submission take a screen shot of this help entry (just a partial shot of the
heading is fine).
PART III
In RStudio open a new R Markdown file. Remember you will get a template. You are going
to edit that template to have it do the following R code chunks.
1. CHUNK 1
attach(diabetes.sav)
Diabetes_data <- diabetes
2. CHUNK 2
scatter.smooth(Diabetes_data$ratio)
Try to clean-up what the template provides to have pertinent information to this task - and
include your name etc. You will need to use knitr to render the document into an HTML -
Take a screen shoot of the resultant HTML document to include in the assignment submission.
PART IV
We have gone through of a lot of R material. Please answer at least ONE of the following (you
can give more feedback if you would like)
1. What is the most puzzling aspect of R to you so far? [as said above, can do more than
ONE]
2. If all is clear (nothing to answer in #1), what use can you envision for R in your research?
PLEASE SUBMIT
PART I - were you able to complete as shown above? If there were any issues, please give
your work around.