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
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]) }
> ___
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@
3 matches
Mail list logo