Skip to content

dplyr::cummean unexpected results #1387

Closed
@reinholdsson

Description

@reinholdsson

I get unexpected results when using dplyr::cummean, see the following example:

a <- rep(99, 9)
a == dplyr::cummean(a)
# [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE
as.integer(dplyr::cummean(a))
# [1] 99 99 99 99 99 99 98 98 98

with base R:

a == base::cumsum(a)/1:length(a)
# [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

I'm using the latest version of dplyr from github (master branch).

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