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

Error with multiple covariates in 0.17-8 #29

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

Error with multiple covariates in 0.17-8 #29

tkerwin opened this issue May 16, 2017 · 6 comments

Comments

@tkerwin
Copy link

@tkerwin 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
Copy link
Owner

@singmann 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
Copy link
Contributor

@jonathon-love jonathon-love commented May 17, 2017

sure, i'll take a look.

cheers

@singmann
Copy link
Owner

@singmann singmann commented May 17, 2017

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

@jonathon-love
Copy link
Contributor

@jonathon-love 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
Copy link
Owner

@singmann 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
Copy link
Owner

@singmann 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants