Closed ddsjoberg closed 11 months ago
This code returns all the deprecated functons:
db <- tools::Rd_db("admiral")
extract_alias <- function(x) {
stringr::str_extract_all(x, "(?<=\\\\alias\\{)(.*?)(?=\\})")
}
df_all_fns <-
dplyr::tibble(
rd_file_name = names(db),
rd_file_contents = lapply(rd_file_name, function(x) db[[x]] |> as.character() |> paste(collapse = "")),
alias = lapply(rd_file_contents, extract_alias),
deprecated =
lapply(rd_file_contents, function(x) stringr::str_detect(x, pattern = "\\\\keyword\\{deprecated\\}")) |>
unlist()
)
deprecated_fns <-
df_all_fns |>
dplyr::filter(deprecated) |>
dplyr::pull(alias) |>
unlist(recursive = TRUE)
deprecated_fns
#> [1] "derive_param_extreme_event" "derive_var_basetype"
#> [3] "derive_var_confirmation_flag" "derive_var_last_dose_amt"
#> [5] "derive_var_last_dose_date" "derive_var_last_dose_grp"
#> [7] "derive_var_merged_cat" "derive_var_merged_character"
#> [9] "derive_vars_last_dose"
Created on 2023-10-10 with reprex v2.0.2
@bms63
Because deprecations are package version dependent, we should add the package version to the big data frame of variable derivations as well.
we can detect deprecated AND superseded functions
added
in the admiral family we use
@keywords deprecated
to tag deprecated functions. can we parse this from the Rd file/website to remove them or color them red...something to indicate to no longer use these functions...