I'm trying to get a variable geom type using ggplot2 in a Shiny plot.
if (type == "column") {
geom <- geom_col()
} else {
geom <- geom_line() + geom_point()
}
qplot(1:10, 1:10) + geom
This works if we remove the "geom_point" however combining them doesn't return the expression but is rather evaluated separately (which is impossible: cannot add ggproto objects together). Is there some sort of work around that doesn't require storing the plot and then adding the geom?


elsewith alistas follows:geom <- list(geom_line() + geom_point())? - deepseefangeom_col() + geom_point()inside the list function which is still impossible. - Daniel V