Please help me with my school assignment

Please help me with my class problem set! The homework is too hard for me.

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

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!


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.


We will soon have a pinned meta post about this genre of question.