dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
523 stars 78 forks source link

`Error in pryr::where(obj_name) : length(name) == 1 is not TRUE` #153

Closed iago-pssjd closed 2 years ago

iago-pssjd commented 2 years ago

I just formalize my comment in https://github.com/dcomtois/summarytools/issues/66#issuecomment-985631861

library(summarytools)
data("tobacco")
saved_x11_option <- st_options("use.x11")
st_options(use.x11 = FALSE)
transform(tobacco, gender = factor(gender, labels = c(0,1)))[, c("gender", "age.gr")] |> dfSummary()
#> Warning in if (grepl(re1, str, perl = TRUE)) {: the condition has length > 1
#>  and only the first element will be used
#> Warning in if (grepl(re2, str, perl = TRUE)) {: the condition has length > 1
#>  and only the first element will be used
#> Warning in if (grepl(re3, str, perl = TRUE)) {: the condition has length > 1
#>  and only the first element will be used
#> Error in pryr::where(obj_name) : length(name) == 1 is not TRUE
#> Data Frame Summary  
#> Dimensions: 1000 x 2  
#> Duplicates: 986  
#> 
#> ----------------------------------------------------------------------------------------
#> No   Variable   Stats / Values   Freqs (% of Valid)   Graph          Valid     Missing  
#> ---- ---------- ---------------- -------------------- -------------- --------- ---------
#> 1    gender     1. 0             489 (50.0%)          IIIIIIIIII     978       22       
#>      [factor]   2. 1             489 (50.0%)          IIIIIIIIII     (97.8%)   (2.2%)   
#> 
#> 2    age.gr     1. 18-34         258 (26.5%)          IIIII          975       25       
#>      [factor]   2. 35-50         241 (24.7%)          IIII           (97.5%)   (2.5%)   
#>                 3. 51-70         317 (32.5%)          IIIIII                            
#>                 4. 71 +          159 (16.3%)          III                               
#> ----------------------------------------------------------------------------------------

sessionInfo()
#> R version 4.1.1 (2021-08-10)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 17134)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252   
#> [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C                  
#> [5] LC_TIME=Spanish_Spain.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] summarytools_1.0.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.7         plyr_1.8.6         pryr_0.1.5         pillar_1.6.4      
#>  [5] compiler_4.1.1     base64enc_0.1-3    tools_4.1.1        digest_0.6.29     
#>  [9] lubridate_1.8.0    evaluate_0.14      lifecycle_1.0.1    tibble_3.1.6      
#> [13] checkmate_2.0.0    pkgconfig_2.0.3    rlang_0.4.12       reprex_2.0.1      
#> [17] cli_3.1.0          DBI_1.1.1          rstudioapi_0.13    magick_2.7.3      
#> [21] yaml_2.2.1         xfun_0.28          fastmap_1.1.0      withr_2.4.3       
#> [25] dplyr_1.0.7        stringr_1.4.0      knitr_1.36         generics_0.1.1    
#> [29] fs_1.5.1           vctrs_0.3.8        tidyselect_1.1.1   glue_1.5.1        
#> [33] R6_2.5.1           fansi_0.5.0        tcltk_4.1.1        rmarkdown_2.11    
#> [37] tidyr_1.1.4        pander_0.6.4       purrr_0.3.4        magrittr_2.0.1    
#> [41] rapportools_1.0    codetools_0.2-18   matrixStats_0.61.0 backports_1.4.0   
#> [45] htmltools_0.5.2    ellipsis_0.3.2     assertthat_0.2.1   utf8_1.2.2        
#> [49] stringi_1.7.5      crayon_1.4.2

Created on 2021-12-03 by the reprex package (v2.0.1)