1. Introduction

What you are looking at is a Rmarkdown (.rmd) file. This is generally used to convert R code and its note into a document, whether it be used for instructional purposes, as a tutorial, or reporting. Rmarkdown files are extremely useful in creating reproducible workflows.

One major difference between Rmarkdown files and normal R code is the commenting system that is put in place. Currently the text you are reading has a “black color”. This signals to R when creating the output file that the text will is a text body. However, the # is blue. This is because commenting outside of an r script (shaded in gray) signals a section header. This helps compartmentalize sections and code to create better structured reports.

2. Graph

For the purpose of this homework, you will create your first Rmarkdown file. We will use the data set “ChickWeight” that is already embedded in R. This data reports a chicks’s weight based on the diet and age of the chick. In the R code below (shaded box), you will need to generate a graph that you believe best explains the data you are observing. You will notice that echo = TRUE, which will also display your Rcode for the graph that is generated. In section 3, you will need to interpret your graph and explain the rationale for the graph you generated. You will need to use ggplot to generate your graph. You will be judge on the following criteria:

  1. Rcode
  2. Clarity and design of graph
  3. Interpretation of graph and justification of your approach

Tip: You will need to change the structure of some of your columns.

# Load data
data("ChickWeight")

# Load ggplot2 into R environment
library(ggplot2)

# Graph
ggplot(data = ChickWeight, aes(x= weight, y = Time))+
  geom_point()+
  theme_bw()

#Input code here
ggplot(data = ChickWeight, aes(x= weight, y = Time))+
  geom_point()+
  theme_bw()

# 3. Reflection
#I noticed that the chicks weight increased every 2 days from a range of around 15% to 25%