I have 10 excel files in a folder that all have the same columns. The end result is bind_rows and combine them all. Each file represents a week (in this case weeks 1-10). I am looking to see how I can add a new column called "Week" to the final product. Each file name looks like "...wk1.xlsx", "...wk2.xlsx", etc. I am trying to figure out how I can detect "wk1", etc and format that into a new column in a list of data frames.
Here's what I have...
files <- list.files(path ="Users/Desktop/week", pattern = "*.xlsx", full.names= T) %>%
lapply(read_excel, sheet =4, skip =39) %>%
bind_rows()