Question
1. I need to get RStudio code following by these instructions. Use the R Markdown file `midterm.Rmd` for answering the questions below. Remember to fill
1. I need to get RStudio code following by these instructions.
Use the R Markdown file `midterm.Rmd` for answering the questions below. Remember to fill in your name at the top of the R Markdown document and be sure to save, commit, and push (upload) frequently to Github so that you have incremental snapshots of your work. When youre done, follow the [How to submit](#how-to-submit) section below to submit your Midterm Exam for grading.
## The mammals sleep dataset
For the Midterm Exam, you will be creating visualizations of the `msleep` dataset, which is loaded automatically with the `tidyverse` package. This is an updated and expanded version of the mammals sleep dataset. Updated sleep times and weights were taken from V. M. Savage and G. B. West. A quantitative, theoretical framework for understanding mammalian sleep. Proceedings of the National Academy of Sciences, 104 (3):1051-1056, 2007. The dataset contains 83 observations over 11 variables.
| Variable | Description | | :------- | :---------- | | `name` | common name | | `genus` | Taxonomic rank used for classifying organisms | | `vore` | carnivore, omnivore, insectivore, or herbivore? | | `order` | Taxonomic rank used for classifying organisms | | `conservation` | the conservation status of the animal | | `sleep_total` | total amount of sleep, in hours | | `sleep_rem` | REM sleep, in hours | | `sleep_cycle` | length of sleep cycle, in hours | | `awake` | amount of time spent awake, in hours | | `brainwt` | brain weight in kilograms | | `bodywt` | body weight in kilograms | ## Questions
1. Create a density plot that allows you to answer the following question: on average, do carnivores, herbivores, insectivores, or omnivores have the longest stage of REM sleep? Then, answer the question, ignoring any `NA` values in the `vore` column.
Hint You will need to include two separate inputs inside the `aes()` function, and also use `alpha = 0.5` somewhere so that you can see the distributions. |
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