[R] position of a specific character

Hua Li hualihua at yahoo.com
Tue Jul 15 01:05:31 CEST 2008


Well, actually, what I really want is a way to quickly find the fragment that contained equal number of "(" and ")", starting from the end of the character. In the case of

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)"

that means finding the part: "(E:2.32,((G:0.67,J:0.67):0.44,H:1.11):1.21)" automatically!


Thanks a lot!

Hua



--- On Mon, 7/14/08, Hua Li <hualihua at yahoo.com> wrote:

> From: Hua Li <hualihua at yahoo.com>
> Subject: [R] position of a specific character
> To: "R-help" <r-help at r-project.org>
> Date: Monday, July 14, 2008, 6:57 PM
> 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