'How to resolve error: Argument 1 must have names when using map( ) pluck( ) in R to list( )?
I have this:
list(list(result="0001"),list(result="0002")) %>%
purrr::map(pluck, 'result') %>%
dplyr::bind_rows()
output: Error: Argument 1 must have names.
The error occurs because the result in the list result "0001" and "0002" have the same name [1], output:
[[1]]
[[1]]$result
[1] "0001" <---- [1]
[[2]]
[[2]]$result
[1] "0002" <---- [1]
How to restart dianically for n cases the name? Expected Output:
[[1]]
[[1]]$result
[1] "0001" <---- [1]
[[2]]
[[2]]$result
[2] "0002" <---- [2]
Possibly it must be some transform or function between map() and bind_rows()
purrr::map(pluck, 'result') %>%
????
dplyr::bind_rows()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
