tidyverse / purrr

A functional programming toolkit for R
https://purrr.tidyverse.org/
Other
1.28k stars 272 forks source link

pmap output names help file #1124

Closed ggrothendieck closed 3 months ago

ggrothendieck commented 7 months ago

The help file for pmap says

The output names are determined by the input names.

but the names of BOD are c("Time", "demand") and the output has no names. There were some SO posts guessing that it means the names of the first column of the input (https://stackoverflow.com/questions/78310377/name-output-of-pmap-on-tibble/78310769#78310769) or the first column with names in the input (https://stackoverflow.com/questions/78314849/naming-of-elements-in-purrrmap). Please clarify.

str(pmap(BOD, ~ .x + .y))
## List of 6
## $ : num 9.3
## $ : num 12.3
## $ : num 22
## $ : num 20
## $ : num 20.6
## $ : num 26.8
hadley commented 4 months ago

Looking at the source code, yes, the names come from names of the first element.