Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To complete this homework, please create an R script. Present your answers with code. Use comments to note which question you are answering, e.g.. #

To complete this homework, please create an R script. Present your answers with code. Use comments to note which question you are answering, e.g.. # Question 1, part a

For problems below, use the msleep data.

To import dataset, use these codes, and the dataset is in the ggplot2 library.

(install.packages("tidyverse") install.packages("ggplot2") library("tidyverse") library("ggplot2") data(msleep) View(msleep)

The data frame is in ggplot2, so once youve loaded the tidyverse, you should have access. Do View(msleep) and help(msleep) to get a feel for the data. Write an R script to do all of the following tasks:

image text in transcribedimage text in transcribedimage text in transcribed

2. Write the R code that will create each of the plots below. You will need ggplot2 code, and you may also need dplyr code for some plots, to get the data just right. You do not have to have the exact same colors as my plots, and it's ok if your title is centered, rather than left-justified, but your plots should look very close to mine. See notes for each plot, e.g., plot (d) asks for you to comment on the plot, too. Again, please use comments to state which homework question your code is answering, e.g.: # Question 2, part a a. Note title (with quotes around vore) and style of bars. Conservation status of animal by "vore" 1.00 - conservation domesticated count carni herbi insecti insecti omni vore b. Note the title and the y-axis label. Total Hours of Sleep by "vore" vore Total Hours of Sleep herbi insecti omni herbi insecti vore c. Note there are no 'NA' vores. Total Hours of Sleep by "vore" carni density herbi insecti omni Omni 15 Total Hours of Sleep d. For this plot, do the log transformation using a scale verb in ggplot. Do make your background look like this one. Question to answer in a comment: Why was a log transformation used? Try doing it without the transformation, and explain why the transformation allows us to interpret the relationship in a better way. Brain Weight by Body Weight (log scale) Brain Weight (log scale) 1e+01 1e+03 Body Weight (log scale) 2. Write the R code that will create each of the plots below. You will need ggplot2 code, and you may also need dplyr code for some plots, to get the data just right. You do not have to have the exact same colors as my plots, and it's ok if your title is centered, rather than left-justified, but your plots should look very close to mine. See notes for each plot, e.g., plot (d) asks for you to comment on the plot, too. Again, please use comments to state which homework question your code is answering, e.g.: # Question 2, part a a. Note title (with quotes around vore) and style of bars. Conservation status of animal by "vore" 1.00 - conservation domesticated count carni herbi insecti insecti omni vore b. Note the title and the y-axis label. Total Hours of Sleep by "vore" vore Total Hours of Sleep herbi insecti omni herbi insecti vore c. Note there are no 'NA' vores. Total Hours of Sleep by "vore" carni density herbi insecti omni Omni 15 Total Hours of Sleep d. For this plot, do the log transformation using a scale verb in ggplot. Do make your background look like this one. Question to answer in a comment: Why was a log transformation used? Try doing it without the transformation, and explain why the transformation allows us to interpret the relationship in a better way. Brain Weight by Body Weight (log scale) Brain Weight (log scale) 1e+01 1e+03 Body Weight (log scale)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions