I have a simple function wrapping a ggplot graph :
library(ggplot2)
myGraph <- function(data,x,y) {
ggplot(data, aes_string(x=x,y=y,group=1) +
geom_line() %>%
return()
}
And I would like to add an argument to the function so that I can flip the axes, or not. a boolean which, if it is true, add a line
coord_flip() +
to the code.




