I want to display cumulative summary functions with lattice.
First I tried to get cumulated data:
library(lattice)
data(barley)
d.cum <- with( barley, by( yield, INDICES=list(site=site,year=year), FUN=cumsum ) )
I got a list of vectors.
I tried to get a dataframe which I could use in xyplot.
But neither of the following functions led to the goal:
d.cum.df1 <- as.data.frame.list( d.cum )
d.cum.df2 <- as.data.frame.array( d.cum )
Then I tried to solve my problem within the panel function.
But now I had to set a value for ylim.
test.xyplot <- function( data=barley, yr=1931, ymax=600, type='l', ... ){
print( xyplot( data=data, subset=year==yr
, type=type
, panel=function( x, y, ... ){
panel.xyplot( x, cumsum(y), ... )
}
, ylim=c( 0, ymax )
, yield ~ variety | site
, scales=list( x=list( alternating=1, rot=90 ) )
, ...
))
}
What could I do to get a dataframe containing the cumulative values
of ``yield'' which I could use to get the cumulative summary plots?
Thanks - Wolfram
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html