[R] Annual cumulative sums from time series

2005-02-10 Thread Georg Hoermann
Hello world, I am actually transferring a course in data management for students in biology, geography and agriculture from statistica to R - it works surprisingly well. If anyone is interested in my scratch/notepad (in German language), please see

Re: [R] Annual cumulative sums from time series

2005-02-10 Thread Petr Pikal
Hi Georg If you know which value belongs to which year you can use tapply, by, aggregate family like: years-rep(c(2000,2001,2002,2003), each=10) values-(1:40) test-cbind(years,values) test-data.frame(test) aggregate(test$values,list(y=test$years),sum) Cheers Petr On 10 Feb 2005 at 11:01,

Re: [R] Annual cumulative sums from time series

2005-02-10 Thread Peter Dalgaard
Dimitris Rizopoulos [EMAIL PROTECTED] writes: maybe something like this: dat - data.frame(years=rep(1994:2004, each=10), x=rnorm(110), (I thought they abolished the 10 month year after the failure of the French revolution. :-) ) y=rnorm(110)) lapply(split(dat[,-1], dat$years), cumsum) or

RE: [R] Annual cumulative sums from time series

2005-02-10 Thread Brahm, David
Georg Hoermann [mailto:[EMAIL PROTECTED] wrote: www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv ... contains a 10 year dataset. We often need cumulative *annual* sums (sunshine, precipitation), i.e. the sum must reset to 0 at the beginning of the year. I know of cumsum(), but I do

Re: [R] Annual cumulative sums from time series - SOLVED + questions

2005-02-10 Thread Georg Hoermann
Roger Bivand wrote: On Thu, 10 Feb 2005, Georg Hoermann wrote: Hello world, based on the code of Roger I have now two solutions: the first one (one line for the whole dataset) - cut here -- erle - read.csv(url(http://www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv;)) jahre