I have a data frame with a load profile for one year. The first column is stored as POSIXct by hour from "2011-01-01 00:00:00" to "2011-12-31 23:00:00". Second columns is stored as numeric with several data.
df <- as.data.frame(matrix(ncol = 2,nrow = 8760))
df[,2] <- as.data.frame(rnorm(8760,50000,10000))
df[,1] <- as.data.frame(seq(from = as.POSIXct("2011-01-01 00:00:00"),
to = as.POSIXct("2011-12-31 23:00:00"),
by = "hours"))
I want to calculate an average day load profile. I've tried to work with the xts package
and period.apply
but I wasn't working. Any ideas?
Thanks
mean()
as the aggregation function. – Dirk Eddelbuettel