Names in indexed errors in `map2()` can be misleading
netique opened this issue · 0 comments
netique commented
The recently introduced indexed error messages are super helpful, many thanks! However, I’ve spent some time head-scratching recently because I had some ill-sorted named lists that I wanted to merge using dplyr
's bind_rows()
and the error message sort of navigated me to compare list elements by name, not by index.
Maybe in case of map2()
, can we have a note that the name of list element refers only to the first list? Or even better, names of both lists could be provided. If both names are equal at the given index, it can be left as it is currently implemented.
What do you think about that?
purrr::map2(
list(a = 1),
list(b = 1),
\(x, y) stop()
)
#> Error in `purrr::map2()`:
#> ℹ In index: 1.
#> ℹ With name: a.
#> Caused by error in `.f()`:
Created on 2024-09-11 with reprex v2.1.0