This lab is an analysis of data in the CDC file, which we imported into RStudio in Lab 1. The following command or something similar must be repeated for each run of Knitr. The exact form of this command is probably different on your computer. You can determine the required command by importing cdc.Rdata into RStudio using the File -> Open process. Copy the command that RStudio places into your console when you do this.
load("~/Downloads/cdc.Rdata")
This lab is based on a lab created by OpenIntro.org. Place your answers to the specified questions in the locations indicated. Be careful to keep the R code you need within chunks. Always include the R code an output needed to answer the questions.
Here’s a silly comment. Now let’s insert some R code.
str(cdc)
## 'data.frame': 20000 obs. of 9 variables:
## $ genhlth : Factor w/ 5 levels "excellent","very good",..: 3 3 3 3 2 2 2 2 3 3 ...
## $ exerany : num 0 0 1 1 0 1 1 0 0 1 ...
## $ hlthplan: num 1 1 1 1 1 1 1 1 1 1 ...
## $ smoke100: num 0 1 1 0 0 0 0 0 1 0 ...
## $ height : num 70 64 60 66 61 64 71 67 65 70 ...
## $ weight : int 175 125 105 132 150 114 194 170 150 180 ...
## $ wtdesire: int 175 115 105 124 130 114 185 160 130 170 ...
## $ age : int 77 33 49 42 55 55 31 45 27 44 ...
## $ gender : Factor w/ 2 levels "m","f": 1 2 2 2 2 2 1 1 2 1 ...
hist(cdc$age)