[R] library sets: A & EMPTY does not work; gset_intersection(A,EMPTY) works

Czerminski, Ryszard Ryszard.Czerminski at astrazeneca.com
Wed Mar 31 16:50:08 CEST 2010


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}}



More information about the R-help mailing list