Skip to content

Please make .progress= argument explicit in keep(), discard(), compact(), and perhaps others. #1249

@krivit

Description

@krivit

My original request was to enable it for these functions, but it looks like .progress= already works in these functions but is not documented, and the .progress= argument is not consumed.

library(purrr)

slow_is_odd <- function(x) {
  Sys.sleep(1)
  x %% 2 != 0
}

keep(1:4, slow_is_odd, .progress = "Checking for oddness")
#> Checking for oddness ■■■■■■■■■■■■■■■■■■■■■■■           75% |  ETA:  1s
#> [1] 1 3

discard(1:4, slow_is_odd, .progress = "Checking for evenness")
#> Checking for evenness ■■■■■■■■■■■■■■■■                  50% |  ETA:  2s
#> [1] 2 4

It looks like .progress="..." gets passed not to the predicate but to the purrr:::map_() call in purrr:::where_if(), though I am not completely certain why.

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