I am importing the data from multiple excel files using the readxl package and I made a function in my script so that I can only import specific sheets that I need:
read_excel_sheets <- function(excelDoc) {
sheets <- readxl::excel_sheets(excelDoc)
sheets <- sheets[4:6]
x <- lapply(sheets, function(X) readxl::read_excel(excelDoc, sheet = X))
return(x)
}
#load files in folder
rawfiles <- list.files()
IMPORT <- lapply(rawfiles, FUN = read_excel_sheets)
After importing all the files from my folder into my script, IMPORT becomes a list[10] that contains a list[3] inside of it, basically lists inside of a list.
I have tried working with just one excel file and using unlist() to see if I can get my sheets out of the lists of list but that did not work.
Test <- read_excel_sheets("Hop_L_Trial1.xlsx")
Test_Test <- unlist(Test)
I've also tried:
rawfiles <- list.files()
IMPORT <- lapply(rawfiles,
FUN = read_excel_sheets)
Test_3 <- rbindlist(IMPORT)
How can I join my data into one data table?