[R] Dynamic arguments in rbind function

2010-01-04 Thread Steven Kang
Hi, all Basically, I have unknown number of data that need to be imported and collapsed row-wisely. The code below works fine, however the rbind function may require 50 arguments if there are 50 data files... Thus, I would like to explore whether there are any methods in using dynamic objects

Re: [R] Dynamic arguments in rbind function

2010-01-04 Thread Duncan Murdoch
On 04/01/2010 7:31 PM, Steven Kang wrote: Hi, all Basically, I have unknown number of data that need to be imported and collapsed row-wisely. The code below works fine, however the rbind function may require 50 arguments if there are 50 data files... Thus, I would like to explore whether

Re: [R] Dynamic arguments in rbind function

2010-01-04 Thread Sundar Dorai-Raj
Use a list instead of assign then do.call(rbind, thelist). import.files - c(a.txt, b.txt, c.txt, d.txt, e.txt) imp - vector(list, length(import.files)) for (i in 1:length(import.files)) { imp[[i]] - read.delim(import.files[i], sep = , header = TRUE) } combined - do.call(rbind, imp) HTH,