and this errors as well with:
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments suggest different rows: 1, 18, 3, 8, 4, 5
the difference between the example you point to and your choice of sw_films, is that the latter is more complex; it is like a list of lists of the type seen in the example.
I.e. if you just take the first element from sw_films then the approach from example works :
Thank you for solution, could you please answer if possible my previous questions ?
I mean, how to check where was an argument 7 and additionally that error about different numbers of rows 1, 18, 3, 8, 4, 5.
Purrr/tidyverse error messages are a bit tricky to decipher but I would like to learn how to get somewhere where I could look for solution. I tried with rlang::last_error() but it was cryptic to me as well.
The most common tool I use to debug an error in a function call is using either of debug()/debugonce()
I.e in this case the error reported comed from dplyr::bind_rows() so debug(dplyr::bind_rows) and rerun the map. You are then in a 'browser' and you can poke around to see where the error is thrown; you can see the inputs etc.
Here is a more directly illustrative example of how the dplyr bind_rows error is triggered:
> bind_rows(list(a=1,b=2),list(a=3,b=4))
# A tibble: 2 x 2
a b
<dbl> <dbl>
1 1 2
2 3 4
> bind_rows(list(a=1,b=2),list(a=3))
# A tibble: 2 x 2
a b
<dbl> <dbl>
1 1 2
2 3 NA
> bind_rows(list(a=1,b=2),list(a=3,4))
Error in `bind_rows()`:
! Argument 2 must have names.
Run `rlang::last_error()` to see where the error occurred.
I.e the error is of that kind
in the do.call version; its cbind.data.frame function that you could try to debug through (likely a painful task)
but again here is a somewhat illustrative example of the problem
cbind.data.frame(list(a=1:2,b=3:4))
cbind.data.frame(list(a=1:2,b=3:5)) #making b one longer than a
Thank you very much indeed for examples and detailed explanation. It means a lot.
I have watched this about debugging as well, good stuff yet a bit more advanced for me: