[R] which() with multiple conditions

pdb philb at philbrierley.com
Mon Oct 1 14:02:11 CEST 2012


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?

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.



More information about the R-help mailing list