(read many files)
Claudia Paladini wrote:
Dear ladies and gentlmen, I want to import a directory with about 400 files (.dat) in R. I know how to import a single file (with scan...) but I've good no idea how to import 400 at once. Can you help me ? Thanks a lot! Claudia
setwd("c:/myfiles/")
## list.files uses regular expressions.
## For reading all files which start with "S" use for example:
files <- list.files(pattern="^S.*")
## then read the data within a loop, e.g.:
dat2 <- NULL
for (f in files) {
dat <- read.table(f)
dat2 <- rbind(dat2, dat)
}
Thomas P.