Re: [R] storing ggplot objects as components of a vector

2008-02-15 Thread ONKELINX, Thierry
You'll need to store it in a list rather than a vector. library(ggplot2) DF<-data.frame(A=rnorm(12),B=c(1:12),C=rep(c(1:4),each=3)) Q <- list() PAC<-geom_point(mapping=aes(x=A,y=B),data=DF[DF$C==1,]) P<-ggplot()+PAC Q[[length(Q) + 1]] <- P Q[[1]] You could shorten this into library(ggplot2) DF<-

Re: [R] storing ggplot objects as components of a vector

2008-02-15 Thread Uwe Ligges
Gallego Liberman, Matias wrote: > Hi. > > I have a lot of plots that i need to store as components of a vector. > Here you have an example > >> DF<-data.frame(A=rnorm(12),B=c(1:12),C=rep(c(1:4),each=3)) >> Q<-c() >> length(Q)<-3 You need a list, hence replace the last two lines by: Q <- vec