Try this:
s <- c("12384", "TYU123123","AVC3939", "hhr1919", "TYU0029")
grep("^TYU", s)
On Tue, Jun 23, 2009 at 11:51 AM, njhuang86 <[email protected]> wrote:
>
> Hi all. Suppose I have a vector of strings ie: ["12384", "TYU123123",
> "AVC3939", "hhr1919", "TYU0029"]
>
> Is there an efficient method that would allow me to return a vector of the
> position of strings that start with "TYU"? So essentially, I would like to
> get back in return [2, 5]. Anyways, any help with be greatly appreciated!
> --
> View this message in context:
> http://www.nabble.com/Vector-of-string-tp24167271p24167271.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [email protected] 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.