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

Duncan Murdoch murdoch.duncan at gmail.com
Wed Jan 23 17:23:08 CET 2013


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 r...{{dropped:5}}
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list