Skip to content

Should accumulate and accumulate_right keep names of the input? #446

@AshesITR

Description

@AshesITR

I was quite surprised to see that accumulate_right and accumulate do not keep the names of the input list.
For my case it makes perfect sense to do so, because I am aggregating along a hierarchy.

Maybe there should be an argument to accumulate(_right) for keeping the names?
For compatibility it might be like this:

l %<>% accumulate(myfun) -> no names
l %<>% accumulate(myfun, .keep_names = TRUE) -> leaves names(l) untouched

Currently I work around this with
l %<>% {set_names(accumulate(., myfun), names(.)) wich is somewhat clunky.

I could submit a PR with the necessary changes if desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementwipwork in progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions