[R] Odp: Vectorize tapply(...,cumsum) output
Petr PIKAL
petr.pikal at precheza.cz
Wed Apr 9 15:07:48 CEST 2008
Hi
it is a work for do.call
try
Nc<-do.call(c,N)
xyplot(Nc ~
t,groups=i,type="o",key=simpleKey(as.character(1:3),x=0,y=1,lines=T))
Regards
Petr
petr.pikal at precheza.cz
r-help-bounces at r-project.org napsal dne 09.04.2008 14:53:41:
> I would like to graph cumulative counts
> and use tapply(...,cumsum) to get
> the cumulative counts.
> For instance:
> library(lattice)
> t<-rep(1:4,each=3) #time
> i<-rep(1:3,times=4) #categories
> n<-rpois(length(t),t) #count
> xyplot(n ~ t,groups=i,
> type="o",key=simpleKey(as.character(1:3),x=0,y=1,lines=T))
> N<-tapply(n,t,cumsum)
>
> Now, what is the best way to convert N
> to a vector that can be plotted?
> E.g.
> xyplot(N ~ t,groups=i,
> type="o",key=simpleKey(as.character(1:3),x=0,y=1,lines=T))
>
> Or is there a better way to get cumulative graphs?
>
> Thanks,
> Gerrit.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list