subset( DM, "B" != x ) This is covered in the Introduction to R document that comes with R. -- Sent from my phone. Please excuse my brevity.
On December 6, 2017 3:21:12 PM PST, David Winsemius <dwinsem...@comcast.net> wrote: > >> On Dec 6, 2017, at 3:15 PM, Ashta <sewa...@gmail.com> wrote: >> >> Hi all, >> In a data set I have group(GR) and two variables x and y. I want to >> remove a group that have the same record for the x variable in each >> row. >> >> DM <- read.table( text='GR x y >> A 25 125 >> A 23 135 >> A 14 145 >> A 12 230 >> B 25 321 >> B 25 512 >> B 25 123 >> B 25 451 >> C 11 521 >> C 14 235 >> C 15 258 >> C 10 654',header = TRUE, stringsAsFactors = FALSE) >> >> In this example the output should contain group A and C as group B >> has the same record for the variable x . >> >> The result will be >> A 25 125 >> A 23 135 >> A 14 145 >> A 12 230 >> C 11 521 >> C 14 235 >> C 15 258 >> C 10 654 > >Try: > >DM[ !duplicated(DM$x) , ] >> >> How do I do it R? >> Thank you. >> >> ______________________________________________ >> R-help@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. > >David Winsemius >Alameda, CA, USA > >'Any technology distinguishable from magic is insufficiently advanced.' > -Gehm's Corollary to Clarke's Third Law > >______________________________________________ >R-help@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. ______________________________________________ R-help@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.