Skip to content
Prev 169320 / 398502 Next

R command to compare two vectors? [SEC=UNCLASSIFIED]

Try this:
[1] "c"
[1] "b" "d" "f" "h"
Is this a bug?
Jin
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Gabor Grothendieck
Sent: Thursday, 5 February 2009 11:07
To: Jorge Ivan Velez
Cc: R-help at r-project.org
Subject: Re: [R] R command to compare two vectors?

Here is one other way:

bnota <- setdiff(b_tmp, a_tmp)

gives the members of b_tmp that are not in a_tmp so length(bnota) == 0
if all of b_tmp is in a_tmp.

On Wed, Feb 4, 2009 at 6:56 PM, Jorge Ivan Velez
<jorgeivanvelez at gmail.com> wrote:
______________________________________________
R-help at 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.