更新时间:2023-02-26 19:59:42
问题是你把 X
作为聚合的参数而不是数字字段(例如 T1
> 或 T2
).
The problem was that you put X
as the argument to aggregate rather than a numeric field (e.g. T1
or T2
).
library(xts)
mydata <- read.csv("data.csv")
times <- mydata$Time
X <- as.POSIXct(times)
X <- as.xts(X)
period.apply(mydata$T1, INDEX = endpoints(X, "minutes", 5), function(x) mean(x, na.rm=T))