like searching m or [m,n] in [1,n,m,e,m,n,n,u].

I want the exact match of all occurrences of m and n in the last vector. Therefore, grep is not helpful as it will extract if there are also mm and mmm.

Cheers,

Carol


________________________________
 From: Ista Zahn <istazahn@gmail.com>

Cc: "r-help@stat.math.ethz.ch" <r-help@stat.math.ethz.ch> 
Sent: Monday, May 21, 2012 3:38 PM
Subject: Re: [R] all occurences of an element in a vector

Hi Carol,

I'm not sure what a "sub-vector in a vector" is, but I think you might
be looking for ?grep

Best,
Ista


> Hi,
> How do you identify all occurences of an element or a sub-vector in a vector as opposed to match, %in%, and intersect which find the first occurrence of an element?
>
> Cheers,
>
> Carol
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
	[[alternative HTML version deleted]]

