Hello,
Consider this simple example
# A tibble: 2 x 1
mylist
<list>
1 <list [3]>
2 <list [4]>
tibble(mylist = list(list('a', 'b', 'c'),
list('aa', 'bb', 'cc', 'dd'))) %>%
mutate(t = map(mylist, ~.x[2,length(.x)]))
Error: Problem with `mutate()` input `t`.
x incorrect number of dimensions
i Input `t` is `map(mylist, ~.x[2, length(.x)])`.
Run `rlang::last_error()` to see where the error occurred.
I am trying to slice the list mylist
from the second element to the last one. I do not understand why my syntax does not work.
Any ideas?
Thanks!