I want to read all the Excel files one by one to temp.data variable. Is there a way to do it? I tried this
for (i in 1:15) {
temp.data <- read_excel(file.path("../source",files$file_path[[i]]))
}
Or is there an alternative way for NOT using for loop here?
Thanks in advance :)
If you want the ouptut in a data frame and you have relevant files in the "source" folder, the following should do:
purrr::map_dfr(list.files("../source", full.names = TRUE), read_excel)
If you have only specific files included in a vector as it appears from your code, this may serve you well:
purrr::map_dfr(file.path("../source",files$file_path), read_excel)