richarddmorey / BayesFactor

BayesFactor R package for Bayesian data analysis with common statistical models.
https://richarddmorey.github.io/BayesFactor/
132 stars 49 forks source link

Incompatibility with tibbles #80

Closed tomwallis closed 7 years ago

tomwallis commented 7 years ago

I ran into an error whereby if you pass lmBF a tibble (e.g. as output by dplyr), one receives an error like:

result <- lmBF(y~x1*x2, dat)

Error in checkFormula(formula, data, analysis = "lm") : 
  Dependent variable must be numeric.

The dependent variable is numeric, and shows as such in any way you care to view the data.

The error can be fixed by explicitly changing the tibble to a dataframe:

result <- lmBF(y~x1*x2, as.data.frame(dat))

It would be good if the BayesFactor package could handle this internally, because the error message is rather cryptic and if one inspects the object, the dependent variable is indeed numeric. I don't know however, if this is a problem on your side or with tibble.

tomwallis commented 7 years ago

Thanks for fixing!