Skip to content
Prev 38785 / 398500 Next

apply() question

On Thu, 16 Oct 2003, Robin Hankin wrote:
Note that while do.call("rbind",a) is the natural solution it may in fact
be faster to create a matrix and use a loop to put things in it.

rval<-matrix(ncol=4, nrow=sum(sapply(a,nrow)))
i<-1
for(ai in a){
	r<-nrow(ai)
	rval[i+1:r,]<-ai
	i<- i+r
}


	-thomas