boxuancui / DataExplorer

Automate Data Exploration and Treatment
http://boxuancui.github.io/DataExplorer/
Other
512 stars 88 forks source link

plot_bar error 'x' and 'units' must have length > 0 #106

Closed eyadsibai closed 5 years ago

eyadsibai commented 5 years ago
Error in unit(rep(1, nrow), "null") : 
  'x' and 'units' must have length > 0

I have attached a file with the data

test.zip

boxuancui commented 5 years ago

@eyadsibai I am able to run plot_bar without any problems. Are you using the latest version of DataExplorer?

test <- read.csv("test.csv")
plot_bar(test)

test

My sessionInfo():

R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.3

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages: [1] ggplot2_3.1.0 DataExplorer_0.7.1

loaded via a namespace (and not attached): [1] igraph_1.2.4 Rcpp_1.0.0 rstudioapi_0.9.0 knitr_1.21 magrittr_1.5 tidyselect_0.2.5 [7] munsell_0.5.0 colorspace_1.4-0 R6_2.4.0 rlang_0.3.1 plyr_1.8.4 dplyr_0.8.0.1
[13] networkD3_0.4 tools_3.5.2 parallel_3.5.2 grid_3.5.2 data.table_1.12.0 gtable_0.2.0
[19] xfun_0.5 withr_2.1.2 htmltools_0.3.6 digest_0.6.18 yaml_2.2.0 lazyeval_0.2.1
[25] assertthat_0.2.0 tibble_2.0.1 crayon_1.3.4 gridExtra_2.3 purrr_0.3.0 htmlwidgets_1.3
[31] evaluate_0.13 glue_1.3.0 rmarkdown_1.11 labeling_0.3 compiler_3.5.2 pillar_1.3.1
[37] scales_1.0.0 pkgconfig_2.0.2

boxuancui commented 5 years ago

This might also be related to #95.

eyadsibai commented 5 years ago

this is weird! yes I am running the latest version with exactly this dataset. worth mentioning that I read the file using data.table

boxuancui commented 5 years ago

I tried fread and no problem either. Could you paste your sessionInfo() here?

eyadsibai commented 5 years ago
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.10

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] data.table_1.12.0  DataExplorer_0.7.0

loaded via a namespace (and not attached):
 [1] igraph_1.2.4      Rcpp_1.0.0        rstudioapi_0.9.0  knitr_1.21       
 [5] magrittr_1.5      tidyselect_0.2.5  munsell_0.5.0     colorspace_1.4-0 
 [9] R6_2.4.0          rlang_0.3.1       plyr_1.8.4        dplyr_0.8.0.1    
[13] networkD3_0.4     tools_3.5.1       parallel_3.5.1    grid_3.5.1       
[17] gtable_0.2.0      xfun_0.5          htmltools_0.3.6   digest_0.6.18    
[21] yaml_2.2.0        lazyeval_0.2.1    assertthat_0.2.0  tibble_2.0.1     
[25] crayon_1.3.4      gridExtra_2.3     purrr_0.3.1       ggplot2_3.1.0    
[29] htmlwidgets_1.3   evaluate_0.13     glue_1.3.0        rmarkdown_1.11.10
[33] compiler_3.5.1    pillar_1.3.1      scales_1.0.0      pkgconfig_2.0.2  

I found the issue. It worked when I installed DataExplorer from github instead of from cran. 0.7.0 instead of 0.7.1 0.7.1 is not available through cran https://cran.r-project.org/web/packages/DataExplorer/index.html

boxuancui commented 5 years ago

Yes, that makes sense. I made some changes on how bar charts are plotted. Thanks!

boxuancui commented 5 years ago

In case you wonder what changed: #86