[R] Fast multiple match function

David Winsemius dwinsemius at comcast.net
Tue Apr 7 00:30:41 CEST 2015


On Apr 6, 2015, at 1:56 PM, Keshav Dhandhania wrote:

> Hi,
> 
> I know that one can find all occurrences of x in a vector v by doing
>> which(x == v).
> 
> However, if I need to do this again and again, where v is remaining the
> same, then this is quite inefficient. In my particular case, I need to do
> this millions of times, and length(v) = 100 million.
> 
> Does anyone have suggestion on how to go about it?
> I know of a package called fmatch that does the above for the match
> function. But they don't handle multiple matches.
> 

You should explain why you need to do it millions of times and you should pose a small sample problem that presents the level of complexity needed in a minimal size.

> Thanks
> 
> 	[[alternative HTML version deleted]]

And you should read the Posting Guide where it is strongly advised that you not post in HTML format. I have used gmail and I do know that it is fairly easy to post in plain text.

-- 
David Winsemius
Alameda, CA, USA



More information about the R-help mailing list