Creates a date column set to the first day of the survey month and inserts it immediately after the survey month column. Works on both unlabelled tables (columns `SURVYEAR` / `SURVMNTH`, date column named `SURVDATE`) and labelled tables produced by [label_pumf_columns()] (columns `"Survey year"` / `"Survey month"`, date column named `"Survey date"`).
Examples
# \donttest{
lfs <- get_pumf("LFS", "2023") # NULL if StatCan is unreachable
if (!is.null(lfs)) {
# Unlabelled
lfs |> add_lfs_SURVDATE() |> dplyr::select(SURVYEAR, SURVMNTH, SURVDATE) |>
dplyr::distinct() |> dplyr::collect()
# Labelled
lfs |> label_pumf_columns() |> add_lfs_SURVDATE() |>
dplyr::select(`Survey year`, `Survey month`, `Survey date`) |>
dplyr::distinct() |> dplyr::collect()
close_pumf(lfs)
}
# }
