library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag():    dplyr, stats

Horizontal Stripes

This is an exploration of the horizontal stripes problem in the diamonds dataset. First replicate the problem and note that there is an apparent range of undesirable values of price per carat for many combinations of cut, color and clarity.

diamonds %>% 
  sample_frac(size=.1) %>% 
  mutate(ppc = price/carat) -> lild 
  
lild %>% 
  ggplot(aes(x=cut,y=ppc)) + 
  geom_jitter(alpha=.1) +
  facet_grid(color~clarity)