Hello fellow useRs.
I need your help.
I have multiple excel files stored in a folder.
I want to create a for loop that will read through the files and create different data frames.
What I mean is that, for each excel file that it reads, it generates 1 data frame in R.
So far this is what I have
max_length <- list.files(path = 'Data/raw_data/',
pattern = "*.xlsx",
full.names = T) %>% length
listofdfs <- data.frame()
for(i in 1:max_length){
name[i] <- list.files(path = 'Data/raw_data/',
pattern = "*.xlsx",
full.names = T)[i]
df[i] <- read_excel(name[i])
}
}
But it is not working at all....
I already tried a couple of things but with no luck.
If you also have another suggestion on how to do this, feel free to share.