corybrunson / ggalluvial

ggplot2 extension for alluvial plots
http://corybrunson.github.io/ggalluvial/
GNU General Public License v3.0
497 stars 34 forks source link

Error when running the demo code about Titanic #25

Closed zlfccnu closed 5 years ago

zlfccnu commented 5 years ago

Description of the issue

Reproducible example (preferably using reprex::reprex())

titanic_wide <- data.frame(Titanic) head(titanic_wide)

> Class Sex Age Survived Freq

> 1 1st Male Child No 0

> 2 2nd Male Child No 0

> 3 3rd Male Child No 35

> 4 Crew Male Child No 0

> 5 1st Female Child No 0

> 6 2nd Female Child No 0

ggplot(data = titanic_wide, aes(axis1 = Class, axis2 = Sex, axis3 = Age, y = Freq)) + scale_x_discrete(limits = c("Class", "Sex", "Age"), expand = c(.1, .05)) + xlab("Demographic") + geom_alluvium(aes(fill = Survived)) + geom_stratum() + geom_text(stat = "stratum", label.strata = TRUE) + theme_minimal() + ggtitle("passengers on the maiden voyage of the Titanic", "stratified by demographics and survival")

Error: Warning message: Computation failed in stat_alluvium(): Evaluation error: as_dictionary() is defunct as of rlang 0.3.0. Please use as_data_pronoun() instead. It seems that the latest version of rlang package was released at 2018-10-22 which is just one day later than the latest version of "ggalluvial".

UPDATE: I have downgraded the rlang package and the error is gone.

corybrunson commented 5 years ago

@zlfccnu thank you for raising the issue. I executed the code myself, originally with rlang v0.2.2 installed and again after installing v0.3.0.1. In both cases i successfully reproduced the diagram. I'm not sure why as_dictionary() is being called, since i don't explicitly call it in ggalluvial. Are the other dependencies up to date?

I would like ggalluvial to work well with the most recent versions of its dependencies. If you encounter the same problem with rlang v0.3.0.1, could you post the results of sessioninfo::session_info()?

zlfccnu commented 5 years ago

@corybrunson Thanks for the reply, I have updated all my packages and now ggalluvial works well with rlang v0.3.0.1. Thus I can not check the original sessioninfo::session_info(). My new sessionifo is :

R version 3.5.1 (2018-07-02) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.5 LTS Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.6.0 LAPACK: /usr/lib/lapack/liblapack.so.3.6.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] rlang_0.3.0.1 bindrcpp_0.2.2 ggalluvial_0.9.1 ggplot2_3.1.0
loaded via a namespace (and not attached): [1] Rcpp_0.12.19 rstudioapi_0.8 bindr_0.1.1 magrittr_1.5 tidyselect_0.2.5 [6] munsell_0.5.0 colorspace_1.3-2 R6_2.3.0 plyr_1.8.4 dplyr_0.7.7
[11] tools_3.5.1 grid_3.5.1 gtable_0.2.0 withr_2.1.2 digest_0.6.18
[16] yaml_2.2.0 lazyeval_0.2.1 assertthat_0.2.0 tibble_1.4.2 crayon_1.3.4
[21] purrr_0.2.5 tidyr_0.8.2 glue_1.3.0 labeling_0.3 compiler_3.5.1
[26] pillar_1.3.0 scales_1.0.0 pkgconfig_2.0.2

Maybe this problem rised because I have so many outdated packages and some packages explicited called as_dictionary(). You can colsed the issue now. Thanks!

corybrunson commented 5 years ago

Thank you! I'm glad it's working for you now.