My purpose is to read multiple files from a directory into a giant table. But running the code reports
error: "invalid description argument'.
Anyone has idea why this happens? I checked my files, they are all in the same format.
dir<- "D:\\Concentration" #work dir
filename<- list.files(dir)
### Read in data file
Data<-read.table(paste(dir,filename,sep="/"),sep=",")
You can use full.names=T
in the list.files
so you dont need to set directory. That way you code is more portable. From the comments @akrun
fnames <- list.files(dir, full.names = T)
do.call(rbind, lapply(fnames, read.table, sep=","))