Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This lab task requires the mammals sleep data given in msleep dataset under packageggplot 2 . You can directly use msleep dataset after loading package
This lab task requires the mammals sleep data given in msleep dataset under packageggplot You can directly use msleep dataset after loading package ggplot It containsthe sleep times and weights for a set of mammals. Details of variables are given below:column name Descriptionname common namegenus taxonomic classifying rankvore carnivore, omnivore, herbivore,order taxonomic rankconservation the conservation status of the mammalsleeptotal total amount of sleep, in hourssleeprem rem sleep, in hourssleepcycle length of sleep cycle, in hoursawake amount of time spent awake, in hoursbrainwt brain weight in kilogramsbodywt body weight in kilogramsBefore doing the following tasks, you are suggested to use summary to view a descriptivesummary for each variable in the dataset Create a new dataframe named as sleep which includes variable vore and variables from sleeptotal to bodywt, for mammals of three vore types: carnivore,omnivore and herbivore only.Based on the dataframe sleep complete the following tasks In the dataframe sleep add a new variable called diffsw which is thedifference between time spent awake and total sleep time Find summary statistics, including the number of mammals, averages of diffswbrain weight and body weight over the three vore groups. Based on results youobtained, briefly comment on the comparison between vore groups write yourcomment in the code using # Use an appropriate plot to compare the distributions of diffsw over different voregroups of mammals. Briefly comment on how diffsw distributes over different voregroups write your comment in the code using # Use an appropriate plot to visualize the relationship between diffsw and bodywt.Briefly comment on write in the code using # the relationship that you find fromthe plot.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started