I have the following monthly data (ymd format) that I want to convert to daily format:
df <- structure(list(date = structure(c(12053, 12084, 12112, 12143,
12173, 12204, 12234, 12265, 12296, 12326), class = "Date"), adjustment = c(1.55630887185104,
1.54783224400871, 1.54530723219141, 1.55121179039301, 1.55375615090213,
1.55205898416166, 1.54698965704954, 1.54028184281843, 1.53528903295516,
1.53694970254191)), row.names = c(NA, -10L), class = c("tbl_df",
"tbl", "data.frame"))
and my code is:
df %>% group_by(date) %>% expand(date = seq(floor_date(date, unit = "month"), ceiling_date(date, unit="month") - days(1), by="day"))
This code appears to have worked for R 4.1.2
, on Windows on an old but I am on version R version 4.2.1 (2022-06-23)
on macOS and I get the following error:
Error in `dplyr::summarise()`:
! Problem while computing `..1 = expand(data = dplyr::cur_data(), ..., .name_repair = .name_repair)`.
ℹ The error occurred in group 1: date = 2003-01-01.
Caused by error in `object[[name, exact = TRUE]]`:
! object of type 'closure' is not subsettable
Run `rlang::last_error()` to see where the error occurred.
Is my code outdated? Do other people get a similar error?