I am going to import 125 .rds files (not reading as a list, and I am no plan to bind them) as .rds files in R.
I wrote a for loop, however it doesn't work:
######getting paths/files/file names with no extention
file_paths <- list.files(path = here::here("~/folder"), pattern = "\.rds", full.names = TRUE)
files <- dir(pattern = "*.rds")
file_names <- gsub(pattern = "\.rds$", replacement = "", x = basename(file_paths))
for loop for reading .rds files
for (i in 1:length(file_names)){
files[i] <- readRDS( file_paths[i])
}
Thank you!