rownames, colnames lost after applying roll_* function
mahl opened this issue · 2 comments
mahl commented
rownames, colnames lost after applying roll_* function on matrix.
kevinushey commented
Thanks; I'll take a look at this.
kevinushey commented
Column names are now preserved, but I'm not sure what the right way to propagate row names here is exactly. For example:
library(RcppRoll)
m <- matrix(1:16, nrow = 4)
rownames(m) <- letters[1:4]
colnames(m) <- LETTERS[1:4]
m
#> A B C D
#> a 1 5 9 13
#> b 2 6 10 14
#> c 3 7 11 15
#> d 4 8 12 16
roll_mean(m, 3)
#> A B C D
#> [1,] 2 6 10 14
#> [2,] 3 7 11 15
What row names should be applied in this case? Do we carry forward the first row names ('a' and 'b')? Does it depend on alignment / fill?