ggplot() +
layer(
data = diamonds, mapping = aes(x = carat, y = price),
geom = "point", stat = "identity"
)
In the above example, I am wondering if I can specify the parameters for the "aes" function by indexes.
I know that carat and price correspond to the 1st and 8th elements in the names array of diamond. Can you advice why the following does not work?
ggplot() +
layer(
data = diamonds, mapping = aes(x = names(diamonds)[1], y = names(diamonds)[8]),
geom = "point", stat = "identity"
)
Thanks, Derek