I understand that every day is represented in your data, including days of the week and weekends, but days for which there is no data are NA (as opposed to the fact that they are not present at all). In the future, please provide some test data for better clarity.
Besides your decision, if you have enough data, you can execute ar in weekly data only by retrieving the last missing value on Friday or until Friday:
library(zoo) # test data library(chron) # is.weekend z <- zoo(100:130, as.Date("2000-01-01") + 0:30) z[is.weekend(time(z))] <- NA # extract Fridays zfri <- na.locf(z)[format(time(z), "%w") == 5]
(If there are no missing spots, it can be reduced by replacing na.locf(z) with z .)
Another possibility is to use 1, 2, ... for time, but give them names, in this case you can always find out what date the point belongs to, checking the name of your time.
z1 <- na.omit(z) time(z1) <- setNames(seq_along(z1), time(z1))
source share