I have a data frame with 8 variables, I tried to plot bar plots of 3 variables(discrete variables) in one page using the following script:
lyst <- list(colnames(mydata[3:5]))
pl<-lapply(lyst, function(i)ggplot(mydata, aes_string(i)) + geom_bar(aes_string(fill=i)))
marrangeGrob(pl, nrow=2, ncol=2)
At first it worked, but now I get the following error message:
Error: More than one expression parsed
Call rlang::last_error()
to see a backtrace.
rlang::last_error() More than one expression parsed Backtrace:
base::lapply(...)
global::FUN(X[[i]], ...)
ggplot2::aes_string(i)
base::lapply(...)
ggplot2:::FUN(X[[i]], ...)
rlang::parse_expr(x).
Any one have an idea how to fix this error?