It seems like the compute_age_years() function should return a 1 for 52 weeks. Instead it seems to return 365.25/7. We know there are always 52 weeks in a year.
Session Information
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)
What happened?
It seems like the compute_age_years() function should return a 1 for 52 weeks. Instead it seems to return 365.25/7. We know there are always 52 weeks in a year.
Session Information
R version 4.4.0 (2024-04-24 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale: [1] LC_COLLATE=English_United States.utf8 [2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: America/New_York tzcode source: internal
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] pharmaversesdtm_1.0.0 admiraldev_1.1.0 admiral_1.1.0
loaded via a namespace (and not attached): [1] tidyr_1.3.1 utf8_1.2.4 R6_2.5.1 lubridate_1.9.3
[5] tidyselect_1.2.1 magrittr_2.0.3 glue_1.7.0 stringr_1.5.1
[9] tibble_3.2.1 pkgconfig_2.0.3 timechange_0.3.0 dplyr_1.1.4
[13] generics_0.1.3 lifecycle_1.0.4 cli_3.6.2 fansi_1.0.6
[17] vctrs_0.6.5 compiler_4.4.0 purrr_1.0.2 rstudioapi_0.16.0 [21] tools_4.4.0 hms_1.1.3 pillar_1.9.0 rlang_1.1.3
[25] stringi_1.8.3
Reproducible Example
compute_age_years(c(52, 365.25/7), "weeks")
[1] 0.9965777 1.0000000