Homework 1

pdf

School

University of Texas *

*We aren’t endorsed by this school

Course

381

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

1

Uploaded by ChefFalcon3581

Report
Homework 1 This homework is due on the deadline posted on edX. Please submit a .pdf file of your output and upload a .zip file containing your .Rmd file. Do NOT include your name or EID in your filenames. In this homework you will be working with the chickwts dataset built into R. This data set contains weight measurements of chicks fed on different food sources to assess their effectiveness on growth rate. head(chickwts) ## weight feed ## 1 179 horsebean ## 2 160 horsebean ## 3 136 horsebean ## 4 227 horsebean ## 5 217 horsebean ## 6 168 horsebean Problem 1: Use ggplot to make a histogram of the weight column. Manually choose appropriate values for binwidth and center . Explain your choice of values in 2-3 sentences. # Your code goes here. ggplot(chickwts, aes(weight)) + geom_histogram(binwidth = 15 ,center= 255 , fill= "black" , col= "grey" ) Your explanation goes here. I choose binwidth = 15, center = 255. The reason why I choose binwidth = 15, is because I see that it covers the pattern of falls and peaks much better than when binwidth = 20, and when we use binwidth = 10, I see there are many peaks, so rather than using 10, I would use 15 I choose center as 255 because, I see the highest value of weight in bin some where around 255. I feel that choosing it as center will be better way for indication of trend. Problem 2: Modify the plot from Problem 1 to show one panel per feed. Hint: Use facet_wrap() . # Your code goes here. ggplot(chickwts, aes(weight)) + geom_histogram(binwidth = 15 , center= 255 ,fill= "blue" , col= "grey" )+ facet_wrap(~feed)
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help