Skip to content

dplyr::count() becomes generic in dplyr 1.0.3 #36

@romainfrancois

Description

@romainfrancois

This creates this problem:

# mosaicCore

<details>

* Version: 0.8.0
* GitHub: https://github.com/ProjectMOSAIC/mosaicCore
* Source code: https://github.com/cran/mosaicCore
* Date/Publication: 2020-09-13 14:10:03 UTC
* Number of recursive dependencies: 95

Run `cloud_details(, "mosaicCore")` for more info

</details>

## Newly broken

*   checking tests ... ERROR
    ```
      Running ‘testthat.R’
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
      > library(testthat)
      > library(mosaicCore)
      > 
      > test_check("mosaicCore")
      Error: C stack usage  7976868 is too close to the limit
      Execution halted
    ```

The infinite loop starts at this test:

test_that("Count works", {
  expect_equal(
    count( ~sex | substance, data = mosaicData::HELPrct),
    c(n_female.alcohol = 36L, n_female.cocaine = 41L, n_female.heroin = 30L))
  expect_equal(
    mosaicCore::count( mosaicData::HELPrct, sort =TRUE),
    data.frame(n = 453L)
  )
})

which calls:

count <- function(x, ...) {
  UseMethod("count")
}

which calls:

#' @export
count.data.frame <-
  function(
    x, ...) {
    dplyr::count(x, ...)
  }

which calls dplyr::count() which is also a generic:

count <- function(x, ..., wt = NULL, sort = FALSE, name = NULL) {
  UseMethod("count")
}

At this point I believe it finds the method from mosaicCore and so that loops ♾️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions