I am very new to R and programming in general and need help with lining up data contained in ~2000 .xls and .xlsx files. Each file begins with a range of 34 - 40 rows of "junk" text before the header; all data under the header has the same dimensions.
The 1st method I tried added data to a list; the vertical format was not useful.
library(readxl)
file.list <- list.files(pattern='*.xls')
dm.list <- lapply(file.list, read_excel)
I am currently attempting to read in one file at a time, delete "junk" text, and write to a .csv file (appending data column-wise).
library(readxl)
file.list <- list.files(pattern='*.xls')
for(i in 1:dim.data.frame(file.list))
store.matrix <- read_excel((paste0("C:\\Users\\jlmine\\Desktop\\qPCRextData\\", file.list[i])), sheet = "Results")
while (store.matrix[1,1] != "Well") #search for header
{ store.matrix <- store.matrix[-c(1)] } #delete non-header rows
write.csv(store.matrix, file = "qPCRdataanalysis.csv", append = TRUE)
The following line is throwing an error:
store.matrix <- read_excel((paste0("C:\\Users\\jlmine\\Desktop\\qPCRextData\\", file.list[i])), sheet = "Results")
Error: 'C:\Users\jlmine\Desktop\qPCRextData\' does not exist. In addition: Warning message: In 1:dim.data.frame(file.list) :
numerical expression has 2 elements: only the first used
"C:\Users\jlmine\Desktop\qPCRextData\" was set as my working directory Any ideas would be greatly appreciated.