I'd like help understanding the following error when using ggplot2 facet_wrap
Error: `rows` must be `NULL` or a `vars()` list if `cols` is a `vars()` list
I'm using fresh installs on a new computer. And am now getting the error on any data frames I try to plot. For example
test.csv
party,status,emissions
Australia,low,20
Australia,mid,30
Australia,high,40
Finland,low,60
Finland,mid,10
Australia,high,45
R
library(ggplot2)
library(dplyr)
test <- read.csv("test.csv")
test %>% ggplot() + geom_path(aes(status,emissions)) %>%
facet_grid(vars(party))
#or facet_wrap(~party)
We need + instead of %>%
library(dplyr)
library(ggplot2)
test %>%
ggplot() +
geom_path(aes(status,emissions)) +
facet_grid(.~ party)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With