Re: [R] Combining 4th column from 30 files

2008-07-23 Thread Henrik Bengtsson
A few things that will help you, if not now then in the future: 1) Preallocate the result object. This allow you to avoid using cbind()/rbind(), which constantly creates a new large copy in each iteration. That will eventually bite you if you have a lot of data. In your case you know the number

Re: [R] Combining 4th column from 30 files

2008-07-23 Thread Henrique Dallazuanna
Maybe: sapply(lapply(dir(pattern="data"), read.table), '[[', 4) On Wed, Jul 23, 2008 at 5:21 AM, Daren Tan <[EMAIL PROTECTED]> wrote: > > Better approach than this brute force ? > > mm <- NULL > for (i in dir(pattern="data")) { m <- readTable(i); mm <- cbind(mm, m[,4]) } > ___

[R] Combining 4th column from 30 files

2008-07-23 Thread Daren Tan
Better approach than this brute force ? mm <- NULL for (i in dir(pattern="data")) { m <- readTable(i); mm <- cbind(mm, m[,4]) } _ [[alternative HTML version deleted]] __ R-help@