I have daily time series (of working days) which I would like to transform in monthly average.
The date format is %d/%m/%Y
, moreover there are some missing observations (NA
).
How can I do this?
# my data
timeseries <- structure(c(309L, 319L, 329L, 339L, 348L, 374L, 384L, 394L, 404L, 413L,
2317L, 2327L, 2337L, 2347L, 2356L, 2382L, 2392L, 2402L, 2412L, 2421L, 2447L, 2457L,
422L, 432L, 441L, 467L, 477L, 487L, 497L, 506L, 2467L, 2477L, 2487L, 2497L, 2506L,
2532L, 2542L, 2552L, 2562L, 2571L, 2597L, 2607L, 2617L, 2627L, 2636L,
[...]), .Label = c("01/01/1992", "01/01/1993", "01/01/1996", "01/01/1997", "01/01/1998", "01/01/1999", "01/01/2001 [...] ), class = "factor")
apply.monthly
function:apply.monthly(x,mean)
wherex
is an xts object – chandler