如何计算 xts 对象的时间加权平均值,例如 5 分钟:我知道 weighted.mean() 但不知道如何处理日期和时间。谢谢
library(xts)
structure(c(28.2, 28.2, 28.2, 28.2, 28.1, 28.1, 28.1, 28.1, 28.1,
28.2, 28.3, 28.2, 28.2, 28.1, 28.1, 28.1, 28.1, 28.1, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27.9, 27.9, 27.9, 27.9,
27.9, 27.9, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8,
27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8, 27.8,
27.7, 27.7, 27.7, 27.8), class = c("xts", "zoo"), .indexCLASS = c("POSIXct",
"POSIXt"), tclass = c("POSIXct", "POSIXt"), .indexTZ = "", tzone = "", index = structure(c(1356998400,
1356998460, 1356998520, 1356998580, 1356998640, 1356998700, 1356998760,
1356998880, 1356998940, 1356999000, 1356999060, 1356999120, 1356999180,
1356999240, 1356999300, 1356999360, 1356999420, 1356999480, 1356999540,
1356999600, 1356999660, 1356999720, 1356999780, 1356999840, 1356999900,
1356999960, 1357000020, 1357000080, 1357000140, 1357000200, 1357000260,
1357000320, 1357000380, 1357000440, 1357000500, 1357000560, 1357000620,
1357000680, 1357000740, 1357000800, 1357000860, 1357000920, 1357000980,
1357001040, 1357001100, 1357001160, 1357001220, 1357001280, 1357001340,
1357001400, 1357001460, 1357001520, 1357001580, 1357001640, 1357001700,
1357001760, 1357001820, 1357001880, 1357001940, 1357002000), tzone = "", tclass = c("POSIXct",
"POSIXt")), .Dim = c(60L, 1L))