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.




--
Peter Ehlers
University of Calgary

______________________________________________
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.

Reply via email to