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

2018-10-22 Thread Knut Krueger
Am 22.10.18 um 18:02 schrieb Bert Gunter: 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. Hi Bert, especially the "match" help area is a little bit confusing. And additiona

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

2018-10-22 Thread Bert Gunter
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 wrote: > Am 22.10.18 um 17:01 schrieb Eric Berger: > > v <- match(

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

2018-10-22 Thread Knut Krueger
Am 22.10.18 um 17:01 schrieb Eric Berger: v <- match(Mydata$DATA1, needles, nomatch=NA) > found <- Mydata[ !is.na (v), ] > missing <- Mdata[ is.na (v), ] Thank you it is working, additionally as Bert suggested, it seems that Mydata[Mydata$DATA1 %in% needles,] is

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

2018-10-22 Thread Eric Berger
Hi Knut, You are almost done. > v <- match(Mydata$DATA1, needles, nomatch=NA) > found <- Mydata[ !is.na(v), ] > missing <- Mdata[ is.na(v), ] HTH, Eric On Mon, Oct 22, 2018 at 5:51 PM Bert Gunter wrote: > Re-read ?match and note the examples for %in% > > -- Bert > Bert Gunter > > "The trouble

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

2018-10-22 Thread Bert Gunter
Re-read ?match and note the examples for %in% -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Oct 22, 2018 at 7:38 AM Knut Krueger wrote: > > Hi

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

2018-10-22 Thread Knut Krueger
Hi to all I would like to reduce the "Mydata" to rows, only if Mydata$Data1 are in needles needles =c(14390, 14391, 14392, 14427, 14428, 14429, 14430, 14431, 14432, 14433, 14434, 14435, 14436, 14437, 14439, 14440, 14441, 15195, 15196, 15197, 15198, 15199, 15200, 15201, 15202, 15203, 1520