On Monday, October 1, 2012, pdb wrote:

> I hope someone can point me in the right direction please.
>
> I have a data frame with a column containing names.  I want to identify the
> columns that contain names in a list.
>
> namestofind <- c('fred','bill',....a long list)
>
> If I only wanted to identify a single name I would use
>
> which(z$name == 'bill')
>
> What syntax would I use to identify all the rows that contain any of the
> names in namestofind?


%in%

Michael


>
> Thanks in advance for the pointer
>
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/which-with-multiple-conditions-tp4644677.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org <javascript:;> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to