0
votes

Supose I have this tree dataframes, where the first row represents a place and first colum represents a day.

z<-c("a", 2, 3)
x<-c("b",2,3)
y<-c("c",4,5)


w<-c("a",5,3)
v<-c("b",6,5)
r<-c("c",2,1)

q<-c("a",2,5)
p<-c("b",4,5)
t<-c("c",2,1)

g<-c(NA,1,2)

df1<-data.frame(g, z,x,y)
df2<-data.frame(g, w,v,r)
df3<-data.frame(g, q,p,t)

I want to plot several graphics containing the information of the 3 dataframes. I want to represent the values of df1, df2 and df3, in the graphic for each day and place. So for example, I want to plot for day 1, df1, df2, df3, and so on. An the same for place a, i want to plot df1, df2, df3.

1
Please show what you've tried so far and where you failed.Roman Luštrik
I don't know any function for ploting diferent dataframes in the same plot..L8call
What are the "days" and "places" supposed to be in this case? And this sample data doesn't make much sense. You can't have character values and numeric values in the same vector. Everything will just be coerced into a character. Maybe you can draw a sketch of the desired output for this sample data. Most likely things will be easier if you just merge the three data.frames before plotting.MrFlick
If you were willing to use ggplot() instead of plot(), it is fairly easy: ggplot() + geom_line(data = df1 ...) + geom_line(data = df2 ...) + geom_line(data = df3 ...). You simply specify that each geom_line uses a different data frame, and they are all plotted together.sam
All plotting functions in R, either in base or in higher level packages can plot data from arbitrary sources, as they all accept passing references to vectors from different data frames or matrices. The tricky part is how to map the different vectors (data series) to different plot properties... You need to be more specific about what you want plotted and how, where the data comes from is secondary.jtatria

1 Answers

0
votes

See ?par and the mfrow argument. You can set the value for mfrow to define how many rows and columns of plots you want in a grid.

https://www.statmethods.net/advgraphs/layout.html