0
catholic_presence <- case_when(swiss$Catholic < 30 ~ "Low rate", swiss$Catholic >= 30 & swiss$Catholic < 70 ~ "Medium rate", swiss$Catholic >= 70 ~ "High rate")
swiss %>% mutate(Canton= rownames(.), "Education Level" = as.factor(edu_level), "Catholic Presence" = as.factor(catholic_presence)) %>% ggplot() + geom_point(aes(x=Examination, y=Agriculture, color=Canton)) + facet_grid("Education Level" ~ "Catholic Presence")

Why does facet_grid create one single plot instead of six with "Low","Medium" and "High" values of both Education and Catholic? Thank you very much in advance, still learning!!

  • Try with backticks "`" around your variable names instead of quotes. – stefan Feb 15 '21 at 22:13
  • `ggplot` and `tidy**` does not go well with strings. You should quote your variable names or use backticks. Example `facet_grid(!!sym("Education Level") ~ !!sym("Catholic Presence"))`. See [this answer](https://stackoverflow.com/a/53168593/10782538). – Oliver Feb 15 '21 at 22:18

0 Answers0