[R] to check if a character string is in a group of character strings

Yuan, Rebecca rebecca.yuan at bankofamerica.com
Wed Jan 23 17:26:38 CET 2013


Hello Duncan,

Thanks for this!

This works!

Best,

Rebecca

-----Original Message-----
From: Duncan Murdoch [mailto:murdoch.duncan at 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}}



More information about the R-help mailing list