Skip to content

Dynamic arguments in "rbind" function

3 messages · Steven Kang, Sundar Dorai-Raj, Duncan Murdoch

#
On 04/01/2010 7:31 PM, Steven Kang wrote:
Computing names like this is almost always a bad idea.  It's better to 
just put the items in a list:

imp <- list()
for (i in 1:length(import.files)) {
   imp[[i]] <- read.delim(eval(paste(".\\",
   import.files[i], sep = "")), header = TRUE)
}

Then to bind them all, simply use do.call(rbind, imp).

Duncan Murdoch