[R] How to extract all rows that contain the value of X in any column?

Mark Na mtb954 at gmail.com
Tue Jun 16 19:41:00 CEST 2009


Hi R-helpers,

I'm trying to use this code

> pvh_dnv<-pvh[sapply(pvh=="dnv"),]

to make a new dataframe containing the rows from pvh that contain the
value of "dnv" in ANY column.

But, it's not working. I get this error

Error in match.fun(FUN) : element 1 is empty;
   the part of the args list of 'is.function' being evaluated was:
   (FUN)

which, to me, is cryptic.

I'd appreciate any help you might provide, thanks!

Mark Na




More information about the R-help mailing list