Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttestBF has issues with tibbles #105

Open
sebastiansauer opened this issue Jun 28, 2017 · 1 comment
Open

ttestBF has issues with tibbles #105

sebastiansauer opened this issue Jun 28, 2017 · 1 comment
Assignees

Comments

@sebastiansauer
Copy link

ttestBF appears to have issues when a tibble is given as input. Consider this tibble:

tibble::tribble(
  ~value, ~group,
  4,    "a",
  1,    "b",
  5,    "a",
  2,    "b"
) -> df

And, in contrast, this data.frame version of the same data:

df2 <- data.frame(df)

To check:

class(df)
class(df2)

In checking.R this evaluation is performed (line 42):

is.numeric(df["value"])
is.numeric(df2["value"])

leading to a wrong conclusion for df, and to a right conclusion for df2. So, that's the problem.

Seen from a different perspective, tibble subsetting does not yield a vector, but a tibble, which is an unexpected behavior, see:

df[, "value"] %>% str
df2[, "value"] %>% str

I suggest replacing the code in checking.R by something like this (see line 42):

is.numeric(df[["value"]])
is.numeric(df2[["value"]])

That should solve the issue.

For reference, line 42:

if(!is.numeric(data[,dv])) stop("Dependent variable must be numeric.")
@richarddmorey
Copy link
Owner

Yes, a number of people have noted that BayesFactor does unexpected things with tibbles. I have not added support for tibbles because I'm not sure about their (intended) behaviour in all cases. Your suggested fix appears neutral, so I'll push that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants