Use the diamonds data from ggplot2 package to perform the following tasks (when appropriate, use round() to show 3 decimal places):

library(tidyverse)
data(diamonds) # load the diamonds data

1.1 What proportion of diamonds are between .30 and 1.08 carats?
1.2 How many of the diamonds have equal x and y dimensions?
1.3 How many of the diamonds have a carat less than the mean?
1.4 How many diamonds have a Premium cut or better? Note that cut is an ordered factor so the levels are in order.
1.5 Which diamond has the highest price per carat? What is the value?
1.6 Make boxplots of the diamond price for each cut.
1.7 Find the 95th percentile for diamond price. Try the quantile() function.

1 Like

You mentioned that you have no clue about using the software - it can definitely be overwhelming! If you could give some background on where youâ€™re stuck, that would be a big help.

For example:

• have you been able to install R and RStudio and get them working properly?
• what information have you covered in class? where in that material could you use some clarification?
• are you able to load the diamonds dataset?
• what have you tried so far?

One of the great things about this site is that you can share the code that youâ€™ve tried. There are easy ways to do this, using something called a reprex - anyone on this site would be happy to help you with the process of creating a reprex!

4 Likes

Soâ€¦weâ€™re not going to do your homework for you. If you have specific questions about R, or ggplot2 Iâ€™m sure folks would be happy to help.
As a starting point: diamonds is a dataset that comes with R, simply typing â€śdiamondsâ€ť in the R console will show you the dataset. Try that, look at the variables available and want form they take, and think about what you need to do to answer these questions.

If youâ€™re totally new to programming, there are any number of tutorials that should get you from 0 to answering these questions in a night, Iâ€™d suggest looking at offerings from Datacamp or Codeschool.

2 Likes