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

Compatibility with tbl_df from dplyr #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dgromer
Copy link
Contributor

@dgromer dgromer commented Sep 15, 2015

This PR adds compatibility for data frames created with data_frame from the dplyr package to the ezANOVA function.
Right now, when passing a tbl_df as the data argument, the function returns the following error:

Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within,  : 
  "dv" must be numeric.

This is caused by

if(!is.numeric(data[,names(data)==dv])){

(line 185 in ez-internal.R)

Whereas [.data.frame returns a vector that can be passed to is.numeric, [.tbl_df retuns a single column data frame that returns FALSE on is.numeric.

Minimal example:

dplyr::data_frame(id = 1:15, group = rep(letters[1:3], each = 5), score = runif(15)) %>% 
  ez::ezANOVA(dv = score, wid = id, between = group)

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

Successfully merging this pull request may close these issues.

1 participant