Then: subset(x, grepl('410|I25', main_condition))
On Wed, Mar 3, 2010 at 11:59 AM, Newbie19_02 <nvanzuy...@gmail.com> wrote: > > Hi, > > That was a good suggestion but I should have been more specific, > PROCHI Date_admission main_condition > CAO3121534 15/08/2006 I501 > 28394 CAO3121534 18/04/1999 I251 > 28395 CAO3121534 18/10/1993 4109 > 28396 CAO3121534 19/01/1988 71946 > 28397 CAO3121534 20/04/1999 I251 > 28398 CAO3121534 21/04/1999 I251 > 28399 CAO3121534 21/05/1998 Z048 > 28400 CAO3121534 21/10/1993 4109 > 28401 CAO3121534 25/02/2002 R634 > 28402 CAO3121534 26/01/2003 B349 > 28403 CAO3121534 27/08/1998 M179 > 28404 CAO3121534 28/05/1999 I501 > 28405 CAO3121534 30/09/1997 I259 > 28406 CAO3121534 31/08/2007 H830 > 28407 CAO3121560 07/07/2000 D688 > > So let's say that I want to subset but only by characters beginning with 410 > and I25? > grep returns any character containing the pattern and so is not entirely > suitable to the extended example. Though it works almost perfectly. Is > there a way to make it match the first three letters? > > THanks, > Natalie > -- > View this message in context: > http://n4.nabble.com/Subset-using-partial-values-tp1576614p1576673.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ R-help@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.