Suppose that I have two data frames
df1 = data.frame(x=1:10)
df2 = data.frame(x=11:20)
and I want a scatter plot with these two series defining the coordinates. It would be simple to do
plot(df1$x,df2$x)
From what I can tell so far about ggplot2, I could also do
df = data.frame(x1 = df1$x, x2 = df2$x)
ggplot(data = df, aes(x=x1, y=x2)) + geom_point()
rm(df)
but that would be slower (for me) than not creating a new data frame, is hard to read, and could lead to increased mistakes (deleting the wrong data frame, writing over a needed data frame, forgetting to remove the excess clutter, etc.). Do I really need to create a separate data frame just to house the data that are already there? Why does the first line of the following work even though it only lists one of the data frames under "data" while the second line does not?
ggplot(data = df1, aes(x=df1$x, y=df2$x)) + geom_point()
ggplot( aes(x=df1$x, y=df2$x)) + geom_point()
ggplot(data.frame(x=df1$x, y=df2$x), aes(x,y)) + geom_point()
?ggplot() + geom_point(aes(x=df1$x, y=df2$x))
,ggplot(data=NULL, aes(x=df1$x, y=df2$x)) + geom_point()
, if you insist on not creating anotherdata.frame
plot(df1$x,df2$x)
and trying to convert my code to make use of ``ggplot` is a nightmare that would be so much worse if I needed to take each of my hundred 4000x100 dimension data frames corresponding to different experiments and then manage thousands more built just for individual plots.