[R] lattice: cumsum and xyplot
Wolski
wolski at molgen.mpg.de
Fri Jun 11 09:33:58 CEST 2004
Hi!
To get a data.frame
as.data.frame(do.call("rbind",d.cum))
Sincerely
Eryk
*********** REPLY SEPARATOR ***********
On 6/11/2004 at 9:17 AM Wolfram Fischer wrote:
>>>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
>>>
>>>______________________________________________
>>>R-help at stat.math.ethz.ch 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
Dipl. bio-chem. Eryk Witold Wolski @ MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin 'v'
tel: 0049-30-83875219 / \
mail: wolski at molgen.mpg.de ---W-W---- http://www.molgen.mpg.de/~wolski
More information about the R-help
mailing list