Reputation: 1
How can I rbind all .RData dataframes which are stored in the same folder with identical column structure? I tried:
my_list <- list.files(my_path, full.names=TRUE)
my_files <- lapply(my_list, load, envir=.GlobalEnv)
library(dplyr)
df <- bind_rows(my_files, .id = "column_label")
Upvotes: 0
Views: 459
Reputation: 389325
You can try :
lapply(my_files, load, .GlobalEnv)
df <- do.call(rbind, mget(sub('\\.RData', '', basename(my_files))))
Upvotes: 1