[R] position of a specific character

Erik Iverson iverson at biostat.wisc.edu
Tue Jul 15 01:03:36 CEST 2008


gregexpr("\\(", frg)


Hua Li wrote:
> Hi All,
> 
> I'm wondering whether there is a quick way to know the position of a
> specific charcater in a long character:
> 
> for example
> 
> frg="((D:41.04,I:41.04):45.05,(((E:2.32,((G:0.67,J:0.67):0.44,H:1.11):1.21)"
> 
> 
> and I would like to know that the 1st, 2nd, 26th, 27th, 28th ...
> character is "(", is there a quick way to do that?
> 
> Thanks!
> 
> Hua
> 
> ______________________________________________ R-help at 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.



More information about the R-help mailing list