[R] multiple match question

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Sep 29 18:44:28 CEST 2004


Peter Dalgaard <p.dalgaard at biostat.ku.dk> writes:

> Wouldn't know about speed, but
> 
>   which(apply(outer(va,vb,"=="),2,any))
>   which(sapply(vb,"%in%",va))
> 
> both seem to do the trick.

Drats... Andy and Uwe are of course right: which(vb %in% va) suffices.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list