Skip to content

Error with multiple covariates in 0.17-8 #29

Closed

Description

@tkerwin

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.

Activity

  1. singmann commented on May 17, 2017

    @singmann
    Owner

    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
    
  2. jonathon-love commented on May 17, 2017

    @jonathon-love
    Contributor

    sure, i'll take a look.

    cheers

  3. singmann commented on May 17, 2017

    @singmann
    Owner

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

  4. jonathon-love commented on May 17, 2017

    @jonathon-love
    Contributor

    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)

  5. singmann commented on May 17, 2017

    @singmann
    Owner

    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.

  6. singmann commented on May 27, 2017

    @singmann
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions