library(tidyverse)
I am trying to use tidyverse tools to selectively bind a list of data using dplyr :: bind_rows (). I split the mtcars dataset to create a basic reproduction of my real data.
Df<-mtcars%>%
split(.$carb)%>%
head()
I can bind it with bind_rows () ...
Df<-Df%>%
bind_rows()
But how can I selectively bind list items. I want to create two lists - the first list of contact list items is 1,3,6, and the second is 2,4,8. I think something like ...
Df<-Df%>%map(~bind_rows(.x,list(.$`1`,.$`3`,.$`6`),list(.$`2`,.$`4`,.$`8`)))
But this code is obviously incorrect, so I would appreciate some suggestions.
source
share