Having trouble trying to read in multiple .xlsx files to R from the same directory. I keep getting the following error.
\"Error in path.expand(file) :
You want to merge all Excel files in a folder?
library(xlsx)
setwd("C:/Users/rshuell001/Desktop/excel_files")
data.files = list.files(pattern = "*.xlsx")
data <- lapply(data.files, function(x) read.xlsx(x, sheetIndex = 1))
for (i in data.files) {
data <- rbind(data, read.xlsx(i, sheetIndex = 1))
}