-
Notifications
You must be signed in to change notification settings - Fork 294
Closed
Labels
tidy-dev-day 🤓Tidyverse Developer Day rstd.io/tidy-dev-dayTidyverse Developer Day rstd.io/tidy-dev-day
Description
It would be nice if map_at() could incorporate tidyselect functions:
library(purrr)
library(tidyselect)
map_at_two <- function(.x, .at, .f, ...){
outvars <- vars_select(.vars = names(.x), .at)
map_at(.x, outvars, .f, ...)
}
x <- list(a = "b", b = "c", aa = "bb")
map_at_two(x, contains("a"), toupper)
#> $a
#> [1] "B"
#>
#> $b
#> [1] "c"
#>
#> $aa
#> [1] "BB"
map_at_two(x, 1, toupper)
#> $a
#> [1] "B"
#>
#> $b
#> [1] "c"
#>
#> $aa
#> [1] "bb"
map_at_two(x, "a", toupper)
#> $a
#> [1] "B"
#>
#> $b
#> [1] "c"
#>
#> $aa
#> [1] "bb"
x <- list("b", "c", "bb")
map_at_two(x, contains("a"), toupper)
#> Error: No tidyselect variables were registered
<sup>Created on 2019-01-02 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup>{tidyselect} has purrr as a dependencies, so it might imply that {purrr} functions used in {tidyselect} have to be rewritten.
Metadata
Metadata
Assignees
Labels
tidy-dev-day 🤓Tidyverse Developer Day rstd.io/tidy-dev-dayTidyverse Developer Day rstd.io/tidy-dev-day