[R] for loop for file names

waltzmiester cwalte03 at shepherd.edu
Thu Jul 30 22:06:39 CEST 2009


I am trying to load binary files in the following fashion

load("pred/Pred_pres_a_indpdt")
load("pred/Pred_pres_b_indpdt")
load("pred/Pred_pres_c_indpdt")
load("pred/Pred_pres_d_indpdt")
load("pred/Pred_pres_e_indpdt")
load("pred/Pred_pres_f_indpdt")

but I would like to set up a for loop to replace the letters a:f

Here is what I have so far:

letter=c("a","b","c","d","e","f")

for(l in letter){

	cat("load('pred/Pred_pres_",l,"_indpdt')",sep="",collapse="","\n")
	
}

That will print the above commands to the console but it will not actually
enter the commands.

Any ideas?

Thanks

Chris
-- 
View this message in context: http://www.nabble.com/for-loop-for-file-names-tp24746012p24746012.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list