all.equal on object with NULL names causes 'Error: not compatible with STRSXP' — bug or expected?

前端 未结 1 966
名媛妹妹
名媛妹妹 2021-02-19 17:52

In the example below, when names are set to NULL, all.equal throws \'Error: not compatible with STRSXP\'
However, if names are set to

相关标签:
1条回答
  • 2021-02-19 18:28

    As @Joran points out, this seems to be related to dplyr. Filed as an issue: https://github.com/hadley/dplyr/issues/219

    Temporary work around (for my need at least. Will not work for all) is to use

     all.equal.default(x, x)
    

    FYI:

      ## STARTING FROM A FRESH SESSION:
    
      set.seed(1)
      x <- data.frame(LETTERS[1:3], rnorm(3))
      names(x) <- NULL
    
      all.equal(x, x)
      # [1] TRUE
    
      ## Load in dplyr
      library(dplyr)
      all.equal(x, x)
      # Error: not compatible with STRSXP
    
    0 讨论(0)
提交回复
热议问题