zoo is an R package that provides an S3 class with methods for totally ordered indexed observations.
Is there a way to create an xts object from a data.frame and preserve data type? My numerics are …
r xts zooinput = cbind(c(3,7,3,5,2,9,1,4,6,4,7,3,7,4)) library(zoo) output = cbind(rollmean(input,4)) print(input) print(output) output: [,1] [1,] 3 [2,] 7 [3,] 3 [4,] 5 [5,] 2 [6,] 9 [7,] 1 [8,] 4 [9,] 6 [10,] 4 [11,] 7 [12,] 3 [13,] 7 [14,] 4 [,1] [1,] 4.50 [2,] 4.25 [3,] 4.75 [4,] 4.25 [5,] 4.00 [6,] 5.00 [7,] 3.75 [8,] 5.25 [9,] 5.00 [10,] 5.25 [11,] 5.25 but when I try to cbind …
r zoo