R- pass argument to ggplot in function
问题 I have a question about how to pass an argument to ggplot if I want to have a 1-x x-axis. The function is being used to specify column name in my data frame. Let's say my data frame looks like x1 x2 x3 x4 0.1 0.2 0.3 0.4 0.3 0.5 0.7 0.9 0.4 0.6 0.8 0.2 And I have a function myfunction<- function(x, y, convert = False){ if (flip) { ggplot(data = mydata, aes(x=1-get(x), y=get(y))) + geom_line() + xlab(x) + ylab(y) } else { ggplot(data = mydata, aes(x=get(x), y=get(y))) + geom_line() + xlab(x) +