[R] Question about setdiff()
raphael.paebst at gmail.com
Mon Jun 2 10:28:41 CEST 2014
It is just as I expected, I just didn't understand how setdiff() works.
On 6/2/14, Pascal Oettli <kridox at ymail.com> wrote:
> From the help page: "Performs *set* union, intersection, (asymmetric!)
> difference, equality and membership on two vectors."
> Hope this helps,
> On Mon, Jun 2, 2014 at 3:57 PM, Raphael Päbst <raphael.paebst at gmail.com>
>> Hello everyone, I have a question which is probably rooted in my lack
>> of understanding when it comes to math.
>> I just did the following:
>> v <- c(1:20)
>> w <- c(11:30)
>> setdiff(v, w)
>> and got:
>> 1 2 3 4 5 6 7 8 9 10
>> Then I did the following:
>> setdiff(w, v)
>> and got, not surprisingly:
>> 21 22 23 24 25 26 27 28 29 30
>> Now I was originally expecting to get bot with the first call of
>> setdiff(v, w) and couldn't find any reason not to expect this from
>> Am I missing somethin vital here or does setdiff() always give me the
>> elements of the first set that are not in the second one and not those
>> which are exclusive to either one, just dropping the ones in the
>> intersection of both sets?
>> Many Thanks in advance
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
> Pascal Oettli
> Project Scientist
> Yokohama, Japan
More information about the R-help