Arshad Ullah
Sep 15, 2019
This is a simple app that will select and display diamonds from the diamonds
dataset
based on the user's input.
The UI has two widgets for input.
It will output the following in the main panel:
The server code will filter out the rows from the diamonds
dataset.
Let's say we pick a price range of 0 to 2000 USD and a carat size of 1.0 (the default values)
The number of diamonds displayed will be as follows.
library(tidyverse)
subDiamonds <- filter(diamonds, price > 0, price<2000) %>% filter(carat>0.9*1,carat<1.1*1) %>% mutate(color = factor(color,ordered = TRUE))
nrow(subDiamonds)
[1] 26
If no rows are selected, an error message will be printed instructing the user to pick a higher price range or lower carat size.
The output 3D scatter plot showing the diamonds picked is displayed with the x-axis as carat, y-axis as color and z-axis as the price. The color of the markers is based on the Cut and the size is based on the Depth.
The actual 3D plot is interactive and displays a bunch of information when hovering over a particular marker. The information displayed are: