I want to build a function where I can pass a variable name as a string and it would return me a ggplot object.
This one works:
myplot <- function(x, y) {
ggplot(data, aes_string(x="x", y="y")) + geom_bar()
}
but in ggplot documentation:
- It is write (I cite): "I recommend using aes_()" and
- "All these functions are soft-deprecated. Please use tidy evaluation idioms instead"
But at that moment I figured out that I do not understand how to use aes_ (to build an example as above, and I don't understand how to enquotation, quotation, quasiquotation means. There is a lot of literature on this in the net, but if someone could show me on this specific example how it works it probably gives me a hint to proceed from here.