Skip to content

Wrong results in "summarise" when characters are used as variable identifiers #567

@patrickroocks

Description

@patrickroocks

The following code

summarise(mtcars, n_distinct("mpg"))

doesn't rise any errors or warning but returns (randomly) wrong results (but approximately the same magnitude) between 16 and 24, whereas the correct use of the variable.

summarise(mtcars, n_distinct(mpg))

returns 25.

Indicated by the stackoverflow question "Randomness in dplyr" a similar behavior occurs on larger datasets too.

Metadata

Metadata

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions