[R] match() question or needle haystack problem for a data.frame

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Mon Oct 22 18:02:35 CEST 2018


I suggest you spend a bit of time with an R tutorial or two and, in
particular learn about "logical indexing," as this basic R construct seems
to be mysterious to you.

Cheers,
Bert




On Mon, Oct 22, 2018 at 8:22 AM Knut Krueger <rhelp using krueger-family.de>
wrote:

> Am 22.10.18 um 17:01 schrieb Eric Berger:
> > v <- match(Mydata$DATA1, needles, nomatch=NA)
> >  > found <- Mydata[ !is.na <http://is.na>(v), ]
> >  > missing <- Mdata[ is.na <http://is.na>(v), ]
>
> Thank you it is working, additionally as Bert suggested, it seems that
>
> Mydata[Mydata$DATA1 %in% needles,]
>
> is doing the same.
>
> Kind Regards Knut
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]




More information about the R-help mailing list