You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regarding inputs of length 0, the documentation for pmap() / map2() states under values:
If all input is length 0, the output will be length 0.
I deducted from this statement that the output would not be length zero, if all inputs would not be 0. I.e. NULLs would be passed on to the functions together with the other elements. However, if I pass a list with at least one element of length 0, to pmap(), the output is length 0.
l<-list(letters, LETTERS, NULL)
x<-purrr::pmap(l,c)
x#> list()#What I would expect x to look like:list(
c(letters[1], LETTERS[1], NULL),
c(letters[2], LETTERS[2], NULL),
c(letters[3], LETTERS[3], NULL)
# etc.
)
#> [[1]]#> [1] "a" "A"#> #> [[2]]#> [1] "b" "B"#> #> [[3]]#> [1] "c" "C"
In the future this will probably become an error. We have adopted the rule that only length 1 vectors can be recycled. See discussion in tidyverse/design#13
Edit: related to #679
Regarding inputs of length 0, the documentation for
pmap()
/map2()
states under values:I deducted from this statement that the output would not be length zero, if all inputs would not be 0. I.e.
NULL
s would be passed on to the functions together with the other elements. However, if I pass a list with at least one element of length 0, topmap()
, the output is length 0.Created on 2019-07-31 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: