[R] Aggregate lag
Matthieu Cornec
matthieu.cornec at gmail.com
Tue May 10 12:55:52 CEST 2005
hello,
Does anybody know how to aggregate a lag series ?
when I try to use aggregate I get the following message
> try<-ts(1:100,start=c(1985,1),freq=12)
> aggregate(try,4,mean,na.rm=T)
Qtr1 Qtr2 Qtr3 Qtr4
1985 2 5 8 11
1986 14 17 20 23
1987 26 29 32 35
1988 38 41 44 47
1989 50 53 56 59
1990 62 65 68 71
1991 74 77 80 83
1992 86 89 92 95
1993 98
> aggregate(lag(try,-1),4,mean,na.rm=T)
Error in rep.int("", start.pad) : invalid number of copies in rep()
Matthieu
More information about the R-help
mailing list