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

datasummary() fails if not attached #802

Closed
fkohrt opened this issue Aug 22, 2024 · 4 comments
Closed

datasummary() fails if not attached #802

fkohrt opened this issue Aug 22, 2024 · 4 comments

Comments

@fkohrt
Copy link

fkohrt commented Aug 22, 2024

I recently became interested into this nice package due to its relatively low dependency count.

However, when running the following code...

modelsummary::datasummary(formula = extra ~ group * mean, data = sleep)

...I get the following error:

Error in modelsummary::datasummary(formula = extra ~ group, data = sleep) : 
  could not find function "labelSubset"

Only attaching the package resolves the issue:

library(modelsummary)
datasummary(formula = extra ~ group * mean, data = sleep)
sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C          
 [3] LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8    
 [5] LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C             
 [9] LC_ADDRESS=C           LC_TELEPHONE=C        
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: UTC
tzcode source: system (glibc)

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

loaded via a namespace (and not attached):
 [1] modelsummary_2.1.1.7 compiler_4.4.1      
 [3] backports_1.5.0      fastmap_1.2.0       
 [5] generics_0.1.3       cli_3.6.3           
 [7] htmltools_0.5.8.1    tools_4.4.1         
 [9] rstudioapi_0.16.0    tables_0.9.28       
[11] knitr_1.48           data.table_1.15.4   
[13] checkmate_2.3.2      xfun_0.47           
[15] digest_0.6.37        rlang_1.1.4         
@vincentarelbundock
Copy link
Owner

Thanks for the report. This is a limitation from the upstream tables package. Try:

tables::tabular(extra ~ group * mean, data = sleep)

@fkohrt
Copy link
Author

fkohrt commented Aug 22, 2024

Do you happen to be able to create code that recreates the issue using only the tables package? The code you provided runs for me (albeit with a warning).

Warning in rep(justification, len = length(x)) :
  partial argument match of 'len' to 'length.out'
Warning in rep(justification, len = length(x)) :
  partial argument match of 'len' to 'length.out'
Warning in rep(justification, len = length(x)) :
  partial argument match of 'len' to 'length.out'
Warning in rep(justification, len = length(x)) :
  partial argument match of 'len' to 'length.out'
Warning in rep(justification, len = length(x)) :
  partial argument match of 'len' to 'length.out'
                 
       group     
       1     2   
       mean  mean
 extra 0.75  2.33

@vincentarelbundock
Copy link
Owner

Looks like you are running the code from the other Issue.

@fkohrt
Copy link
Author

fkohrt commented Aug 22, 2024

Right, sorry for the noise. I created an issue upstream: dmurdoch/tables#30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants