mjskay / tidybayes

Bayesian analysis + tidy data + geoms (R package)
http://mjskay.github.io/tidybayes
GNU General Public License v3.0
725 stars 59 forks source link

stat_eye(normalize="height") produce ddply error #189

Closed ghost closed 5 years ago

ghost commented 5 years ago

Following your own vignette http://mjskay.github.io/tidybayes/articles/tidy-brms.html

set.seed(5) n = 10 n_condition = 5 ABC = tibble( condition = rep(c("A","B","C","D","E"), n), response = rnorm(n * 5, c(0,1,2,1,-1), 0.5) ) m = brm(response ~ (1|condition), data = ABC, control = list(adapt_delta = .99), prior = c( prior(normal(0, 1), class = Intercept), prior(student_t(3, 0, 1), class = sd), prior(student_t(3, 0, 1), class = sigma) ))

m %>% spread_draws(b_Intercept, r_condition[condition,]) %>% mutate(condition_mean = b_Intercept + r_condition) %>% ggplot(aes(x = condition, y = condition_mean)) + stat_eye() # this works

m %>% spread_draws(b_Intercept, r_condition[condition,]) %>% mutate(condition_mean = b_Intercept + r_condition) %>% ggplot(aes(x = condition, y = condition_mean)) + stat_eye(normalize="height") # this fails

Error in ddply(data, c("group", y), function(d) { :

could not find function "ddply"

sessionInfo()

R version 3.6.1 (2019-07-05)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:

[1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C

[5] LC_TIME=Swedish_Sweden.1252

attached base packages:

[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] emmeans_1.4 brms_2.9.6 Rcpp_1.0.2 rstan_2.19.2 StanHeaders_2.18.1-10 cowplot_1.0.0

[7] ggridges_0.5.1 ggstance_0.3.2 openxlsx_4.1.0.1 tidybayes_1.1.0.9000 forcats_0.4.0 stringr_1.4.0

[13] dplyr_0.8.3 purrr_0.3.2 readr_1.3.1 tidyr_0.8.3 tibble_2.1.3 ggplot2_3.2.0

[19] tidyverse_1.2.1 modelr_0.1.4

loaded via a namespace (and not attached):

[1] TH.data_1.0-10 colorspace_1.4-1 rsconnect_0.8.15 estimability_1.3 markdown_1.0

[6] base64enc_0.1-3 rstudioapi_0.10 svUnit_0.7-12 DT_0.7 mvtnorm_1.0-11

[11] lubridate_1.7.4 xml2_1.2.1 codetools_0.2-16 bridgesampling_0.7-2 splines_3.6.1

[16] shinythemes_1.1.2 zeallot_0.1.0 bayesplot_1.7.0 jsonlite_1.6 packrat_0.5.0

[21] broom_0.5.2 shiny_1.3.2 compiler_3.6.1 httr_1.4.0 backports_1.1.4

[26] assertthat_0.2.1 Matrix_1.2-17 lazyeval_0.2.2 cli_1.1.0 later_0.8.0

[31] htmltools_0.3.6 prettyunits_1.0.2 tools_3.6.1 igraph_1.2.4.1 coda_0.19-3

[36] gtable_0.3.0 glue_1.3.1 reshape2_1.4.3 cellranger_1.1.0 vctrs_0.2.0

[41] nlme_3.1-141 crosstalk_1.0.0 ps_1.3.0 rvest_0.3.4 mime_0.7

[46] miniUI_0.1.1.1 gtools_3.8.1 MASS_7.3-51.4 zoo_1.8-6 scales_1.0.0

[51] colourpicker_1.0 hms_0.5.0 promises_1.0.1 Brobdingnag_1.2-6 parallel_3.6.1

[56] sandwich_2.5-1 inline_0.3.15 shinystan_2.5.0 gridExtra_2.3 loo_2.1.0

[61] stringi_1.4.3 dygraphs_1.1.1.6 pkgbuild_1.0.3 zip_2.0.3 rlang_0.4.0

[66] pkgconfig_2.0.2 matrixStats_0.54.0 HDInterval_0.2.0 lattice_0.20-38 labeling_0.3

[71] rstantools_1.5.1 htmlwidgets_1.3 processx_3.4.1 tidyselect_0.2.5 plyr_1.8.4

[76] magrittr_1.5 R6_2.4.0 generics_0.0.2 multcomp_1.4-10 pillar_1.4.2

[81] haven_2.1.1 withr_2.1.2 xts_0.11-2 survival_2.44-1.1 abind_1.4-5

[86] crayon_1.3.4 arrayhelpers_1.0-20160527 grid_3.6.1 readxl_1.3.1 callr_3.3.1

[91] threejs_0.3.1 digest_0.6.20 xtable_1.8-4 httpuv_1.5.1 stats4_3.6.1

[96] munsell_0.5.0 shinyjs_1.0

mjskay commented 5 years ago

Thanks! Yeah, that's fixed in this branch now: https://github.com/mjskay/tidybayes/tree/tidyr-1.0

That fix will trickle down to master before I submit the new version to CRAN.

mjskay commented 5 years ago

Should be fixed on master now