powered by
Get used vars in a ggplot object
get_vars(p, reverse = FALSE, verbose = TRUE)
A character vector of variable names. If reverse is FALSE, returns used variables; if TRUE, returns unused variables.
reverse
FALSE
TRUE
A ggplot object.
ggplot
Whether to return unused vars. Default is FALSE.
Whether to print the message. Default is TRUE.
library(ggplot2) p <- ggplot( data = mtcars, aes(x = mpg, y = wt, colour = cyl) ) + geom_point() get_vars(p) get_vars(p, reverse = TRUE)
Run the code above in your browser using DataLab