Question: 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 packageggplot2. You can directly use msleep dataset after loading package ggplot2. It containsthe sleep times and weights for a set of 83 mammals. Details of 11 variables are given below:column name Descriptionname common namegenus taxonomic (classifying) rankvore carnivore, omnivore, herbivore,order taxonomic rankconservation the conservation status of the mammalsleep_total total amount of sleep, in hourssleep_rem rem sleep, in hourssleep_cycle 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.1. Create a new dataframe named as sleep3, which includes variable vore and 6variables from sleep_total to bodywt, for mammals of three vore types: carnivore,omnivore and herbivore only.Based on the dataframe sleep3, complete the following tasks.2. In the dataframe sleep3, add a new variable called diff_sw, which is thedifference between time spent awake and total sleep time.3. Find summary statistics, including the number of mammals, averages of diff_sw,brain 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 #).4. Use an appropriate plot to compare the distributions of diff_sw over different voregroups of mammals. Briefly comment on how diff_sw distributes over different voregroups (write your comment in the code using #).5. Use an appropriate plot to visualize the relationship between diff_sw 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!