[R] rollmax.zoo : column names NULL

Giles giles.heywood at cantab.net
Mon May 14 11:38:31 CEST 2012


Hi

I am comparing the output of rollmax in two versions of R.  In the
current version, the column names are 'lost' ie NULL in the output; in
the earlier version they were retained.

Function rollapply has the same behaviour as before.

Is this change in rollmax behaviour deliberate?

Thanks

Giles

R2.13.1 + zoo 1.7-4 on Windows 7

> a <- as.zoo(matrix(1:20,4,5,dimnames=list(LETTERS[1:4],letters[1:5])))
> rollapply(data=a,FUN=mean,width=3)
  a b  c  d  e
2 2 6 10 14 18
3 3 7 11 15 19
> rollmax(x=a,k=3)
  a b  c  d  e
2 3 7 11 15 19
3 4 8 12 16 20
> str(colnames(rollmax(x=a,k=3)))
 chr [1:5] "a" "b" "c" "d" "e"

R2.15.0 + zoo 1.7-7

> a <- as.zoo(matrix(1:20,4,5,dimnames=list(LETTERS[1:4],letters[1:5])))
> rollapply(data=a,FUN=mean,width=3)
  a b  c  d  e
2 2 6 10 14 18
3 3 7 11 15 19
> rollmax(x=a,k=3)

2 3 7 11 15 19
3 4 8 12 16 20
> str(colnames(rollmax(x=a,k=3)))
 NULL



More information about the R-help mailing list