insightsengineering / cardx

R Package to Supplement ARD Functions Found in {cards}
https://insightsengineering.github.io/cardx/
Other
14 stars 2 forks source link

[Bug]: Example in README won't run with CRAN version of cardx #172

Closed thisisnic closed 4 months ago

thisisnic commented 4 months ago

What happened?

Hello :)

I installed cardx from CRAN and was trying to run the first example in the README but got an error:

library(cardx)
#> Warning: package 'cardx' was built under R version 4.3.3
cards::ADSL |>
  # keep two treatment arms for the t-test calculation
  dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
  cardx:::ard_stats_t_test(by = ARM, variable = AGE)
#> Error in eval(expr, envir, enclos): object 'ard_stats_t_test' not found

Created on 2024-06-21 with reprex v2.1.0

It works great with the dev version of cardx though! Maybe worth mentioning in the README (I'm happy to submit a PR if you'd like) or maybe just leave if you're planning on a new CRAN release soon anyway - just let me know what you'd prefer :)

sessionInfo()

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] cardx_0.1.0

loaded via a namespace (and not attached):
 [1] utf8_1.2.4        R6_2.5.1          tidyselect_1.2.1  magrittr_2.0.3    glue_1.7.0        tibble_3.2.1      pkgconfig_2.0.3  
 [8] dplyr_1.1.4       generics_0.1.3    lifecycle_1.0.4   cli_3.6.2         fansi_1.0.6       vctrs_0.6.5       compiler_4.3.1   
[15] rstudioapi_0.16.0 tools_4.3.1       pillar_1.9.0      rlang_1.1.3

Relevant log output

No response

Code of Conduct

Contribution Guidelines

Security Policy

Melkiades commented 4 months ago

the name was modified in https://github.com/insightsengineering/cardx/commit/60f0c0d22c1d79a4e03dc37f05a43323ff976fe3 (after the release). the function you are looking for may be called ard_ttest on CRAN release

ddsjoberg commented 4 months ago

We released a very early of cardx onto CRAN, because I knew we were going to do something that may be considered a gray area as far as CRAN rules goes and I didn't want the initial CRAN review of the package force us to remove it.

We're technically accessing the internals of a package with when we grab the default argument values for S3 methods like t.test.formula(). Only the generic is exported and the methods are "internal".

Anyway, we've made many many changes since then!