Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Names in indexed errors in map2() can be misleading #1151

Open
netique opened this issue Sep 11, 2024 · 0 comments
Open

Names in indexed errors in map2() can be misleading #1151

netique opened this issue Sep 11, 2024 · 0 comments
Labels
feature a feature request or enhancement

Comments

@netique
Copy link

netique commented Sep 11, 2024

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

@hadley hadley added the feature a feature request or enhancement label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants