library("ggplot2")
# create first dataframe
data_frame1<-data.frame(col1=c(rep('Grp1',2),rep('Grp2',2),rep('Grp3',2)),
col2=rep(letters[1:3],2),
col3=rep(1:2,3)
)
# create second dataframe
data_frame2<-data.frame(col1=c(rep('Grp1',2),rep('Grp2',2),rep('Grp3',2)),
col2=rep(letters[1:3],2),
col3=rep(1:2,3)
)
# creating list of dataframes
data_frames<-list(data_frame1, data_frame2)
graph<-lapply(data_frames,
function(x)
p<-ggplot(x,aes(x= col3,y= col2,color=factor(col1),
group=factor(col1))) +
geom_line() +
facet_wrap(~col1)
)
print (graph)