Unless I've made a mistake (it happens!) that gives FALSE on the data which the OP said should give TRUE. Ravi Varadhan suggested duplicated(a) & duplicated(b) but that gives the same result for b <- c("n", "m", "o", "m") for which I think the OP would like FALSE
I think this may do it all((a %in% a[duplicated(a)]) == (b %in% b[duplicated(b)])) Hope that helps Keith J <rex.dw...@syngenta.com> wrote in message news:36180405f8418449918ad20618d110fc094e9db...@usetcmsxmb02.nafta.syngenta.org... > ab = paste(a,b,sep=";~;~;~") > flag = length(ab)==length(unique(ab)) > > This should work unless you use 3 consecutive winking elephants in other > places in your program. > > > > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Nipesh Bajaj > Sent: Wednesday, February 09, 2011 10:12 AM > To: r-help@r-project.org > Subject: [R] A question on Duplicating > > Hello I am struggling to accomplice an idea which is as follows: > > I have a vector say: a <- c("a", "b", "c", "a") and another: b <- c("m", > "n", "o", "m"). Length of those 2 vectors are essentially be same. Here > task > is to check the duplicates in the vector 'a' and then to check whether any > duplicates are there in the same places of 'b'. If not, flag a FALSE. > > I above example, it is correct hence TRUE. However in general how can I > implement this? > > Can somebody please help me? > > Thanks, > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. > > > > > message may contain confidential information. If you are not the > designated recipient, please notify the sender immediately, and delete the > original and any copies. Any use of the message by you is prohibited. ______________________________________________ R-help@r-project.org mailing list 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.