Answered step by step
Verified Expert Solution
Link Copied!

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 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

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions