Diamond Price Predictor

J. Hans
8-5-2020

The diamond app

This app uses the diamonds dataset in the ggplot2 library to help users predict diamonds prices. With the app the user can:

  • Select the cut, color, and clarity of a diamond
  • See a plot of the range of expected prices for different sized diamonds with the selected characteristics
  • See the min and max prices for diamonda with the selected characteristics

Here is the dataset used in the app

library(ggplot2)
library(dplyr)
data(diamonds)
nrow(diamonds)
[1] 53940
head(select(diamonds, price, carat, cut, color,clarity))
# A tibble: 6 x 5
  price carat cut       color clarity
  <int> <dbl> <ord>     <ord> <ord>  
1   326 0.23  Ideal     E     SI2    
2   326 0.21  Premium   E     SI1    
3   327 0.23  Good      E     VS1    
4   334 0.290 Premium   I     VS2    
5   335 0.31  Good      J     SI2    
6   336 0.24  Very Good J     VVS2   

The app plots price ranges for diamonds with user-selected attributes

library(ggplot2)
data(diamonds)
ggplot(data = subdiamonds, aes(x = group, y = price)) + 
      labs(x = "carats (range)") + geom_boxplot() + 
      coord_cartesian(ylim = c(0, 20000))

plot of chunk unnamed-chunk-4

Where to find it