x <- 1:9
## February 29th is missing:
dates <- c("1964-02-25", "1964-02-26", "1964-02-27", "1964-02-28", "1964-03-01",
"1964-03-02", "1964-03-03", "1964-03-04", "1964-03-05")
## From 'character' to 'Date' class
dates <- as.Date(dates)
## From 'numeric' to 'zoo' class
x <- vector2zoo(x, dates) #Feb 29th is still missing
## Feb 29th is added to 'y' with a missing value
y <- izoo2rzoo(x, from=dates[1], to=dates[length(dates)])
## Creating a regular sequence from February 1st to the end of March,
## assigning 'NA' to the days in which 'x' do not have a value.
y <- izoo2rzoo(x, from="1964-02-01", to="1964-03-31")
Run the code above in your browser using DataLab