I have a list of dataframes and I would like to be able to select a subset of columns in all those dataframes. In my specific problem, all the dataframes have common headers but some have additional columns so something like
bind_rows wont work.
I want to select only the columns im interested in before converting everything to a single dataframe. Can anyone help. Below is my attempt.
library(tidyverse) mydf <- iris %>% nest(data=-Species) %>% select(-Species) # I only want to select Petal.Length Petal.Width select(mydf, map(. , ~ select(., Petal.Length, Petal.Width)))