xfim / ggmcmc

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

Problem with dev tidyr #49

Closed hadley closed 8 years ago

hadley commented 8 years ago
checking examples ... ERROR
Running examples in ‘ggmcmc-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: ggmcmc
> ### Title: Wrapper function that creates a single pdf file with all plots
> ###   that ggmcmc can produce.
> ### Aliases: ggmcmc ggmcmc-package
> 
> ### ** Examples
> 
> data(linear)
> ggmcmc(ggs(s))  # Directly from a coda object
Plotting histograms
Error in factor(x, levels = 1:n, labels = labels) : 
  invalid 'labels'; length 0 should be 1 or 3
Calls: ggmcmc ... print -> ggs_histogram -> cbind -> gl_unq -> factor
Execution halted

Could you please check to see if this is a new bug in tidyr?

xfim commented 8 years ago

Thank you for taking care of it, Hadley. I confirm that it is not a bug in tidyr, but a possible new behaviour. Previously a call to gather() was generating a factor and now it generates a character vector, and for other functions that variable was needed to be a factor.

Anyway, I have added a check to be sure that a output is the factor. Solved in cdd511e.

hadley commented 8 years ago

Oh in that case you can use the new factor_key = TRUE argument

xfim commented 8 years ago

Great, thank you for the tip. BTW, nice feature. It is very useful. However, I think I will stick with the "manual" approach of checking at the very end that the variable is a factor, given that there are many intermediate transformations involved.