[R] merge large matrices

Sarah Goslee sarah.goslee at gmail.com
Thu Jun 2 22:28:46 CEST 2005


On 6/2/05, Stefan Mischke <mischke at sozpsy.unizh.ch> wrote:
> Dear List
> 
> I have two large matrices A and B. Both have the same dimensions, let's
> say 20k x 30k. About half the cells of B are missing. Now I'm looking
> for an efficient way to merge them, so that the missing values in B are
> replaced by the corresponding values of A.

How about:
B[is.na(B)] <- A[is.na(B)]


Sarah

-- 
Sarah Goslee
http://www.stringpage.com




More information about the R-help mailing list