Using vectors and objects
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →In this exercise, we will study two datasets that are shipped with the ggplot2 package: diamonds – describing the prices of more than 50,000 cut diamonds and msleep – describing the sleep times of 83 mammals. To install the package from CRAN, you can either select Tools > Install packages in the RStudio menu and then write ggplot2 in the text box in the pop-up window that appears, or use the following line of code: install.packages(“ggplot2”)
Provide in the plain text R commands that finds/solves the problems below:
1. View the documentation for the diamonds data and read about different variables. Check the data structures and answer:
a. how many observations and variables are there and what type of variables (numeric, categorical, etc.) are there?
b. Compute summary statistics (means, median, min, max, counts for categorical variables).
c. Are there any missing values?
2. Create a scatterplot with total sleeping time along the x-axis and time awake along the y-axis (using the msleep data).
a. What pattern do you see?
b. Explain the pattern(s).
c. Explain the correlation between total sleeping time and time awake.
Dates and times in R – https://www.stat.berkeley.edu/~s133/dates.html
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds