Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alejandrohagan/7e01e6e4bae4321c20315413e13690c6 to your computer and use it in GitHub Desktop.
Save alejandrohagan/7e01e6e4bae4321c20315413e13690c6 to your computer and use it in GitHub Desktop.
replace_na() with new vs previous anonymous fucntion
## this works
cohorts::cohort_table_day(.data, id_var = customer_id, date = invoice_date) |>
dplyr::mutate(
dplyr::across(dplyr::everything(), ~tidyr::replace_na(., 0))
)
## this doesn't work
cohorts::cohort_table_day(.data, id_var = customer_id, date = invoice_date) |>
dplyr::mutate(
dplyr::across(dplyr::everything(), \(x) tidyr::replace_na(., 0))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment