Below are questions to answer using R, based on the documents you just read. Enter your answers in the Rmd file, using the space provided below each question! When you are done, you should be able to click the “Knit” button and see a pretty version of your assignment.

Answer the following questions using the cdc data that we used in the “Intro to Data” document.

  1. If you run the command below, you will see a graph of people’s weights (x-axis) versus their desired weights (y-axis). Describe the relationship between these two variables.

Most desired weights are lower but there is a few outliers.

## run this command:
plot(cdc$weight, cdc$wtdesire, xlab="Weight", ylab="Desired weight")
  1. Let’s consider a new variable: the difference between desired weight (wtdesire) and current weight (weight). Create this new variable by subtracting the two columns in the data frame and assigning them to a new object called wdiff.
#wdiff <- (cdc$wtdesire - cdc$weight)
# (YOU CAN ADD LINES IF NEEDED)
  1. What type of data is wdiff? If an observation wdiff is 0, what does this mean about the person’s weight and desired weight. What if wdiff is positive or negative?

If it is zero then they are alreay at their desired weight. If its positive or negative then they are not at their desired weight.

# ENTER YOUR R COMMAND(S) HERE
# (YOU CAN ADD LINES IF NEEDED)
  1. Describe the wdiff variable, using commands from the “Intro to Data” document. What does this tell us about how people feel about their current weight?

Most people their current weight does not equal their desired weight.

# boxplot(cdc$weight ~ cdc$wtdesire)
# plot(cdc$weight, cdc$wtdesire, xlab="Weight", ylab="Desired weight")
  1. Using numerical summaries and a side-by-side box plot, determine if men tend to view their weight differently than women.

ENTER TEXT FOR YOUR ANSWER HERE.

# boxplot(cdc$weight ~ cdc$gender)
# summary(cdc$weight)
summary(cdc$gender)
  1. Now it’s time to get creative. Find the mean and standard deviation of weight and determine what percentage of the weights are within one standard deviation of the mean.

Mean = 169.68 Standard Dev. = 40.08097

# mean(cdc$weight)
# sd(cdc$weight)