I am using RGList class, and desire to transform intensity values (R,Rb,G,Gb) and overwrite them into RGList object. If I do it row-wise:

RG$R[i,]<-(R+RG2$R[i,])/(2)

The overwriting is really SLOWWWWWW. On the other hand, If I create a dummy matrix:

QR=matrix(nrow=dim(RG)[1], ncol=dim(RG)[2])

And write the values to it:

QR[i,]<-(R+RG2 $R[i,])/(2)

It is relatively fast (of course I can do it this way, then simply RG$R <-QR, which is ok)

But I'd really like to know why writing to a matrix is so much faster than RGList? Is RGList making a copy each time or something?


-Aaron



	[[alternative HTML version deleted]]

