[R] loop through files in a dir

Pierre Kleiber pkleiber at honlab.nmfs.hawaii.edu
Fri Mar 19 23:38:17 CET 2004


?paste

Fred J. wrote:
> 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".
> thanks
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
-----------------------------------------------------------------
Pierre Kleiber, Ph.D       Email: pkleiber at honlab.nmfs.hawaii.edu
Fishery Biologist                     Tel: 808 983-5399/737-7544
NOAA FISHERIES - Honolulu Laboratory         Fax: 808 983-2902
2570 Dole St., Honolulu, HI 96822-2396
-----------------------------------------------------------------
  "God could have told Moses about galaxies and mitochondria and
   all.  But behold... It was good enough for government work."




More information about the R-help mailing list