Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vignettes using options to reset options back to defaults to avoid CRAN inconsistencies #186

Open
chelseadickens opened this issue Aug 28, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@chelseadickens
Copy link

Prerequisites

For more information, see the CONTRIBUTING guide.

Description

The output I get by running the code below (copied directly from the Post-Processing vignette) does not produce the same output as the table under the "Collapsing Row Labels" section of https://cran.r-project.org/web/packages/Tplyr/vignettes/post_processing.html. Specifically, there are differences in the means and quartiles produced.

dat <- tplyr_table(tplyr_adsl, TRT01P) %>% 
    add_layer(
      group_count(RACE, by = vars("Race n (%)", SEX))
    ) %>% 
    add_layer(
      group_desc(AGE, by = vars("Age (years)", SEX))
    ) %>% 
    build()
  
 dat_show <- collapse_row_labels(dat, row_label1, row_label2, row_label3, indent = "&nbsp;&nbsp;") %>% 
    select(row_label, var1_Placebo)
 dat_show %>%  kable(escape=FALSE)

Steps to Reproduce (Bug Report Only)

  1. I checked to make sure the Tplyr version is the most recent (1.2.1) and that the data from the package matches what is under https://github.com/atorus-research/Tplyr/blob/main/data/tplyr_adsl.rda

  2. I tried calculating the means using dplyr tplyr_adsl %>% filter(TRT01P == "Placebo") %>% group_by(SEX) %>% summarize(mean = mean(AGE, na.rm = TRUE)) and get values that match the output I get from Tplyr (not those in the vignette).
    image

  3. When checking the Post-Processing article at https://atorus-research.github.io/Tplyr/articles/post_processing.html, the outputs match mine. So it seems perhaps the CRAN version of the vignette is out of date somehow?

Expected behavior: Screenshot from the vignette on CRAN:
image

Actual behavior: image

Versions

image

@mstackhouse
Copy link
Contributor

@chelseadickens well... This is incredibly weird. This is hard to decide where to even start looking.

@mstackhouse
Copy link
Contributor

Well I can sleep tonight - this is actually a trickle effect from right here:

options(tplyr.custom_summaries =

The issue is that this option carries forward into subsequent vignettes. Apparently when you build a package, vignettes' R sessions are not truly independent.

@mstackhouse mstackhouse added the documentation Improvements or additions to documentation label Aug 29, 2024
@mstackhouse mstackhouse changed the title Post-Processing vignette on CRAN seems incorrect/out of date Update vignettes using options to reset options back to defaults to avoid CRAN inconsistencies Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants