It seems that "A& B" works the same way as "gset_intersection(A,B)"
as long as A and B are not empty...
see below:
fuzzy_logic("Yager", p=2)
support<- universe<- c('a','b','c','d')
A<- gset(support=support, memberships=c(0.2, 0.2, 0.9, 0),
universe=universe)
B<- gset(support=support, memberships=c(0.211, 0.222, 0.999, 0),
universe=universe)
A
B
A& B
gset_intersection(A,B)
E<- A - A
A& E
gset_intersection(A,E)
fuzzy_logic("Yager", p=2)
support<- universe<- c('a','b','c','d')
A<- gset(support=support, memberships=c(0.2, 0.2, 0.9, 0),
universe=universe)
B<- gset(support=support, memberships=c(0.211, 0.222, 0.999, 0),
universe=universe)
A
{"a" [0.2], "b" [0.2], "c" [0.9]}
B
{"a" [0.211], "b" [0.222], "c" [0.999]}
A& B
{"c" [0.899995]}
gset_intersection(A,B)
{"c" [0.899995]}
E<- A - A
A& E
Error in A& E :
operations are possible only for numeric or logical types
In addition: Warning message:
Incompatible methods ("Ops.gset", "Ops.set") for "&"
gset_intersection(A,E)
{}
--------------------------------------------------------------------------
Confidentiality Notice: This message is private and may contain
confidential and proprietary information. If you have received this
message in error, please notify us and remove it from your system and
note that you must not copy, distribute or take any action in
reliance on it. Any unauthorized use or disclosure of the contents of
this message is not permitted and may be unlawful.
-----Original Message-----
From: Peter Ehlers [mailto:ehl...@ucalgary.ca]
Sent: Wednesday, March 31, 2010 11:43 AM
To: Czerminski, Ryszard
Cc: R-help@r-project.org
Subject: Re: [R] library sets: A& EMPTY does not work;
gset_intersection(A,EMPTY) works
On 2010-03-31 9:30, Peter Ehlers wrote:
Unless I'm missing something, I don't see any method
in pkg:sets for intersection other than gset_intersection.
Whoops, a bit quick on the draw.
There are of course also set_intersection and cset_intersection,
but not AFAICS any method for `&`.
-Peter Ehlers
So you're using the base R function `&` whose help page
tells you that its arguments should be vectors. Yours
aren't.
-Peter Ehlers
On 2010-03-31 8:50, Czerminski, Ryszard wrote:
When using generalized sets from "sets" library
A& EMPTY does not work, but gset_intersection(A,EMPTY) works: example
code below
Is it a bug?
Best regards,
Ryszard
library(sets)
support<- universe<- c('a','b','c','d')
A<- gset(support=support, memberships=c(0.2, 0.2, 0.9, 0),
universe=universe)
class(A)
A
E<- A - A # create empty set
I<- gset_intersection(A, E) #<<< this WORKS
class(I); I
I<- A& E #<<< this DOES NOT WORK
# ---
support<- universe<- c('a','b','c','d')
A<- gset(support=support, memberships=c(0.2, 0.2, 0.9, 0),
universe=universe)
class(A)
[1] "gset" "cset"
A
{"a" [0.2], "b" [0.2], "c" [0.9]}
E<- A - A
I<- gset_intersection(A, E) #<<< this WORKS
class(I); I
[1] "set" "gset" "cset"
{}
I<- A& E #<<< this DOES NOT WORK
Error in A& E :
operations are possible only for numeric or logical types
In addition: Warning message:
Incompatible methods ("Ops.gset", "Ops.set") for "&"
------------------------------------------------------------------------
--
Confidentiality Notice: This message is private and may
...{{dropped:8}}
______________________________________________
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.