[R] regular exprs

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Sun Nov 7 16:15:39 CET 2010

Dear All,

I would appreciate any help with the following: given the vector 'x'

x <- c("Ass1", "Ass.s1", "Ass2", "Ass.s2")

I would like to pick up the positions where the character string 
contains "Ass" but does not contain "Ass.s", so for 'x' that would be 
positions 1 and 3.

I guess this could be programmed around grep() using a suitable regular 
expression, but I haven't managed to succeed.

Thanks in advance.


Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/

More information about the R-help mailing list