Description Usage Arguments Details Value Author(s) See Also Examples
The FuzzySets
class extends the Sets
class to implement a container that also describe different grades of membership in the interval [0,1]
.
1 2 |
relations |
|
... |
Arguments passed to the |
This class does not define any additional slot to the Sets
class.
However, this class defines additional validity checks to ensure that every relation stored in a FuzzySets
are associated with a numeric membership funtion in the interval [0,1]
.
A FuzzySets
object.
Kevin Rue-Albrecht
Sets
, FuzzyHits
, FuzzySets-methods
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # Constructor ----
# Visually intuitive definition of sets, elements, and membership
sets <- list(
set1=c("A"=0.1, "B"=0.2),
set2=c("B"=0.3, "C"=0.4, "D"=0.5),
set3=c("E"=0.8))
# unlist the set names
unlistSets <- rep(names(sets), lengths(sets))
# unlist the element names
unlistElements <- unlist(sapply(sets, names))
# unlist the membership values
unlistMembership <- unlist(sets)
# Reformat as a table
relations <- DataFrame(
element=unlistElements,
set=unlistSets,
membership=unlistMembership
)
fs <- FuzzySets(relations=relations)
# Subsetting ----
fs1 <- subset(fs, set == "set1" | membership > 0.5)
# Coercing ----
# to list (gene sets)
ls1 <- as(fs, "list")
# to matrix (continuous membership)
m1 <- as(fs, "matrix")
# to matrix (multiple observations)
mm1 <- as.matrix(fs, fun.aggregate=min)
# Getters/Setters ----
membership(fs)
fs1 <- fs
membership(fs1) <- runif(length(fs1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.