Skip to content
Prev 200061 / 398506 Next

Automatizing Simulation in R

I often use the paste() and assign() approach that David suggested.
Another approach is to read into R a vector of file names and then 
loop over that vector.
Along the lines of:

infiles <- list.files(pattern='data*.dat')
dlist <- list()
length(dlist) <- length(infiles)
names(dist) <- infiles

for (inf in infiles) {
     tmpd <- read.table(inf,  *other args*)

    ## if you need to keep copies within R of all 500 sets of data
     dlist[[inf]] <- tmpd

     ## data analasyis using tmpd or dlist[[inf]]

}

-Don
At 10:22 AM -0500 11/12/09, David Winsemius wrote: