Need R Studio Code Dataset: diamonds This dataset contains information about 53,940 round-cut diamonds. This dataset is

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Need R Studio Code Dataset: diamonds This dataset contains information about 53,940 round-cut diamonds. This dataset is

Post by answerhappygod »

Need R Studio Code
Dataset: diamonds
This dataset contains information about 53,940 round-cut
diamonds. This dataset is pre- loaded into RStudio as part of the
ggplot2 package.
Install the “tidyverse” package and load “ggplot2” from the
library. You will be using a dataset named “diamonds” that is built
into the ggplot2 package. Store the “diamonds” dataset in data
frame called “diamonds_hw”. Inspect the dataset using the str(),
View(), and summary() commands to be sure everything was read in
correctly. Calculate the standard deviation for each variable. Show
your commands and output.
Create a scatterplot to show the relationship between the price
of a diamond and its carat weight. Label the graph and the axes
appropriately (and with appropriate spelling and capitalization).
Make the datapoints red and center the title of the
graph. Show your commands as well as the graph output.
What does this graph tell the reader? How is price related to
carat weight?
Using the same scatterplot, but without the red color,
differentiate the datapoints based on their clarity on the same
graph, by using color=clarity in the aesthetic
mapping.
Label the graph and the axes appropriately (and with appropriate
spelling and capitalization). Show your commands as well as the
graph output.
Can you identify a relationship between the clarity of the
diamond and its weight from the scatterplot?
Again using ggplot(), create a single graphic with multiple
boxplots to show the distribution of the weight of the diamonds
based on their clarity. Your graph should have one boxplot per
level of clarity [i.e., a boxplot for I1, a boxplot for SI2, a
boxplot forSI1,etc.].
Usedarkblueforyourcolorandcadetblue3foryourfillcolor.
Label the graph and the axes appropriately (and with appropriate
spelling and capitalization). Show your commands as well as
the graph output.
How do you interpret the graph? Does this align with your
findings in the previous scatterplot? Which clarity group has the
heaviest/largest diamond?
Using ggplot(), create a histogram to show the price
distribution of the diamonds in the dataset. Add appropriate titles
for the axes and for the graph. Center the title.
What do you learn from the histogram? Are there any patterns?
How would you describe this distribution? Are there any other
relevant statistics you might calculate?
Using ggplot(), create a bar graph to show the number of
diamonds in each clarity group. Add appropriate titles for the axes
and for the graph. Center the title. Pick colors of your choice
for color and fill.
What do you learn from the bar graph? Most of the diamonds in
this dataset are assigned to which clarity level?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply