Skip to content

weights= argument for froll{mean,sum,...} #5295

@MichaelChirico

Description

@MichaelChirico

Weighted means are pretty common in my experience.

The current workaround is pretty awkward (I might be using a weird approach, CMIIW):

x = 1:10
w = 10:1
frollapply(seq_along(x), n = 3, function(i) stats::weighted.mean(x[i], w[i]))
#  [1]       NA       NA 1.925926 2.916667 3.904762 4.888889 5.866667 6.833333 7.777778 8.666667

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions