xfim / ggmcmc

Graphical tools for analyzing Markov Chain Monte Carlo simulations from Bayesian inference
111 stars 31 forks source link

make source of n() explicit for dplyr >= 1.0 #71

Closed stragu closed 4 years ago

stragu commented 4 years ago

ggs_geweke() sometimes (always?) runs into this error if dplyr 1.0 is installed:

<error/dplyr_error>
Problem with `summarise()` input `n`.
x could not find function "n"
i Input `n` is `n()`.
i The error occured in group 1: Parameter = "deviance", Chain = 1, part = "first".
Backtrace:
  1. MixSIAR::output_JAGS(jags.uninf, mix, source)
  2. ggmcmc::ggmcmc(...)
  4. ggmcmc::ggs_geweke(D)
  4. dplyr::group_by(., Parameter, Chain, part)
 12. dplyr::summarize(., m = mean(value), sde0f = sde0f(value), n = n())
 15. dplyr:::summarise_cols(.data, ...)

This is because of this breaking change in dplyr 1.0: https://github.com/tidyverse/dplyr/pull/4918

This PR makes the source of n() explicit and fixes the issue.

xfim commented 4 years ago

Thank you very much, @stragu . Although I checked for breaks from dplyr-1.0 this one was missed.