How to combine this list of vectors by elements names ?
L1 <- list(F01=c(1,2,3,4),F02=c(10,20,30),F01=c(5,6,7,8,9),F02=c(40,50))
So to g
You can achieve the same result using map function from purrr
map
purrr
map(unique(names(L1)), ~ flatten_dbl(L1[names(L1) == .x])) %>% set_names(unique(names(L1)))
The first line transforms the data by merging elements with matching names, while the last line renames new list accordingly.