Hello Duncan, Thanks for this!
This works! Best, Rebecca -----Original Message----- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, January 23, 2013 11:23 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] to check if a character string is in a group of character strings On 13-01-23 11:14 AM, Yuan, Rebecca wrote: > Hello, > > How can I judge if a string is in a group of string? For example, I would > like to have > > if (subpool in pool){ > }else{ > } if (subpool %in% pool) Duncan Murdoch > > Where > >> pool = c("s1","s2") >> subpool = c("s1") > > How can I write the "subpool in pool" right in R? > > Thanks very much! > > Cheers, > > Rebecca > > > ---------------------------------------------------------------------- > This message, and any attachments, is for the intended...{{dropped:12}} ______________________________________________ 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.