yaweige/ggpcp

Bug for class(diamonds$color) return c("ordered", "factor")

Closed this issue · 2 comments

Bug for class(diamonds$color) return c("ordered", "factor")
heike commented

Just for our own sake - always add a minimal reproducible examples for which the code fails.
That makes it easier to (a) remember what you meant by a bug issue and (b) to do something about it.
In this case, an example would be

library(tidyverse)
library(ggpcp)

diamonds_sample <- sample_n(diamonds, 200)
diamonds_sample %>% 
  ggplot(aes(vars = vars(cut, color, clarity), colour = cut)) +
  geom_pcp(boxwidth = 1) + geom_pcp_box(boxwidth =1)
heike commented

ordered factors are cast to factors in gather_pcp