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

Error with multiple covariates in 0.17-8 #29

Closed
tkerwin opened this Issue May 16, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@tkerwin
Copy link

tkerwin commented May 16, 2017

Example code:

require(psych)
require(afex)
data(msq)
aov_ez(data=msq, dv="Extraversion", id = "ID", between = "condition", 
    covariate=c("TOD", "MSQ_Time"), factorize=FALSE)

In afex 0.16-1, this works fine, but in 0.17-8, I get this error:

Error in `[.data.frame`(data, , between, drop = FALSE) : 
  undefined columns selected

It looks like the names of the covariates are being concatenated in a strange way.

@singmann

This comment has been minimized.

Copy link
Owner

singmann commented May 17, 2017

Thanks for this report, this is most likely due to the changes in 134afd6. Paging @jonathon-love who made this changes.
Are you willing to remove the bug you introduced (I guess)?

See:

require(psych)
require(afex)
data(msq)
aov_ez(data=msq, dv="Extraversion", id = "ID", between = "condition", 
    covariate=c("TOD", "MSQ_Time"), factorize=FALSE, print.formula = TRUE)
# Formula send to aov_car: Extraversion ~ condition + `TOD+MSQ_Time` + Error(ID)
# Error in `[.data.frame`(data, , between, drop = FALSE) : 
#   undefined columns selected
@jonathon-love

This comment has been minimized.

Copy link
Contributor

jonathon-love commented May 17, 2017

sure, i'll take a look.

cheers

@singmann

This comment has been minimized.

Copy link
Owner

singmann commented May 17, 2017

@jonathon-love Actually hold on. I think I got it, seems really minor.

@jonathon-love

This comment has been minimized.

Copy link
Contributor

jonathon-love commented May 17, 2017

yup, i think it's as simple as moving line 415:

if (!is.null(covariate)) covariate <- str_c(covariate, collapse = "+")

down after where the covariates are escaped?

covariate <- escape_vars(covariate)

singmann pushed a commit that referenced this issue May 17, 2017

@singmann

This comment has been minimized.

Copy link
Owner

singmann commented May 17, 2017

Solved in ccada51.

My change was similar to what you suggested:

if (!is.null(covariate)) {
   covariate <- escape_vars(covariate)
   covariate <- str_c(covariate, collapse = "+")
 }

I will push a new bug-free version to CRAN latest next week. Thanks for reporting the bug.

@singmann singmann closed this May 17, 2017

@singmann

This comment has been minimized.

Copy link
Owner

singmann commented May 27, 2017

Fixed version (0.18-0) is on CRAN now: https://cran.r-project.org/web/packages/afex/

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