Hi

I have been trying to loop over lists of files while specifying variables. I am not getting anywhere.

There are basically 3 variables month, year and modelname. My files have the format "tas_",year,"_" ,month,"_", modelname,".txt". I basically want to loop through all the models and put all the data pertaining to that model and year in one list while also naming the list as modelname,"_",year. So basically each list will be 12 long with the files from each month (jan through dec). I have tried using list.files but I do not think you can specify variables in the pattern.

Files<- list.files(path="eg/", pattern="tas_",year,"_" ,month,"_", modelname,".txt", full.names=TRUE)

Does anyone know how to do this? I have 12 models and 2 different years and I want to get all the months of a single year and single model in a single list of files (ie 12 files in a list) with each list specified by the modelname and year.

Thanks

Kanika


________________________________
Please consider the environment before printing this email
Warning: This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.
The views expressed in this email may not be those of Landcare Research New Zealand Limited. http://www.landcareresearch.co.nz

	[[alternative HTML version deleted]]

