[R] loop through files in a dir

Douglas Bates bates at stat.wisc.edu
Fri Mar 19 23:27:58 CET 2004


"Fred J." <phddas at yahoo.com> writes:

> d <- dir("c:/data")
> for (i in d){
>   dt <- read.csv(c("c:/data/",i),header=FALSE)
> }

> wouldn't work because c("c:/data",i) puts out "string"
> "string" where both strings need to be one string. 
> how can I combinde both in one string, c:/data/i like
> the good old perl "I wish".

file.path("C:/data", i)




More information about the R-help mailing list