[R] characters in a string

David Winsemius dwinsemius at comcast.net
Wed Sep 15 17:42:27 CEST 2010


On Sep 15, 2010, at 11:16 AM, rajeshj at cse.iitm.ac.in wrote:

>
> Hi,
>
> I need to check if a string "<rh>a,b,c,d<rh>" is delimited by two  
> "<rh>" 's as efficiently as possible(I need to do this a lot of  
> times) and return TRUE. Can someone suggest a good technique?

 > txt <- "<rh>a,b,c,d<rh>"
 >
 > grep("^<rh>.+<rh>$", txt)
[1] 1

> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list