[R] better than sapply

2005-08-26 Thread Omar Lakkis
I have the following two mapping data frames (r) and (h). I want to fill teh value of r$seid with the value of r$seid where r$cid==h$cid. I can do it with sapply as such: r$seid = sapply(r$cid, function(cid) h[h$cid==cid,]$seid) Is ther a better (faster) way to do this? r -

Re: [R] better than sapply

2005-08-26 Thread Gabor Grothendieck
I don't know if its faster but you could try timing this to find out: r$seid - merge(h, r, by = cid)[,2] On 8/27/05, Omar Lakkis [EMAIL PROTECTED] wrote: I have the following two mapping data frames (r) and (h). I want to fill teh value of r$seid with the value of r$seid where r$cid==h$cid.