[R] Reading in files with variable parts to names

Dieter Menne dieter.menne at menne-biomed.de
Thu Mar 26 20:06:58 CET 2009


Steve Murray <smurray444 <at> hotmail.com> writes:

> I'm trying to read in a whole directory of files which have two variable 
> parts to the file name: year and  month. E.g. comp198604.asc represents 
< April of 1986 - 'comp' is fixed in each case. Years range between
> 1986 to 1995 and months are between 1 and 12.
> 
> Just to be clear, there are 12 files associated with each year: e.g.
comp198601, comp198602, ...
> comp198612  through to comp199501, comp199502 ... comp199512.
 


gr = expand.grid(as.character(1986:1995),sprintf("%02d", 1:12) ,
  stringsAsFactors =FALSE)
filelist = paste(a[,1],a[2,],".asc",sep="")




More information about the R-help mailing list