This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
## Loading required package: ggplot2
## weight feed
## 1 179 horsebean
## 2 160 horsebean
## 3 136 horsebean
## 4 227 horsebean
## 5 217 horsebean
## 6 168 horsebean
## 7 108 horsebean
## 8 124 horsebean
## 9 143 horsebean
## 10 140 horsebean
## 11 309 linseed
## 12 229 linseed
## 13 181 linseed
## 14 141 linseed
## 15 260 linseed
## 16 203 linseed
## 17 148 linseed
## 18 169 linseed
## 19 213 linseed
## 20 257 linseed
## 21 244 linseed
## 22 271 linseed
## 23 243 soybean
## 24 230 soybean
## 25 248 soybean
## 26 327 soybean
## 27 329 soybean
## 28 250 soybean
## 29 193 soybean
## 30 271 soybean
## 31 316 soybean
## 32 267 soybean
## 33 199 soybean
## 34 171 soybean
## 35 158 soybean
## 36 248 soybean
## 37 423 sunflower
## 38 340 sunflower
## 39 392 sunflower
## 40 339 sunflower
## 41 341 sunflower
## 42 226 sunflower
## 43 320 sunflower
## 44 295 sunflower
## 45 334 sunflower
## 46 322 sunflower
## 47 297 sunflower
## 48 318 sunflower
## 49 325 meatmeal
## 50 257 meatmeal
## 51 303 meatmeal
## 52 315 meatmeal
## 53 380 meatmeal
## 54 153 meatmeal
## 55 263 meatmeal
## 56 242 meatmeal
## 57 206 meatmeal
## 58 344 meatmeal
## 59 258 meatmeal
## 60 368 casein
## 61 390 casein
## 62 379 casein
## 63 260 casein
## 64 404 casein
## 65 318 casein
## 66 352 casein
## 67 359 casein
## 68 216 casein
## 69 222 casein
## 70 283 casein
## 71 332 casein
## cwt$feed cwt$weight
## 1 casein 323.6
## 2 horsebean 160.2
## 3 linseed 218.8
## 4 meatmeal 276.9
## 5 soybean 246.4
## 6 sunflower 328.9
## Warning: Removed 2 rows containing missing values (position_stack).
For the first graph I used the dataset, “Chickwt” which measured the weight of chickens by the type of feed they were given. The colors of the dots correspond to the type of feed. The x-axis plots the weight of childrens. The colors clump pretty closely by feed type, and fall along a continuum. You can see that casein yields chickens with the lowest weight, and sunflower seeds yields chickens with the largest weights. The number of chickens surved were different depeneding on the type of feed, so the y-axis shows the number of chickens corresponding to each weight category.
For the second graph, I used the same dataset and constructed a histogram. The bins are categorized by the type of feed, and the y axis is by weight of the chicken. I had to ajust the y values to be from 0 to 400.
For the third graph, I constructed box plots by feed type. The box plots show the interquartile range, similar to the spread of each variable. You can see that casein has the widest spread of values of weights while sunflower has the smallest spread.