The FuzzySets class extends the Sets class to implement a container that also describe different grades of membership in the interval [0,1].

FuzzySets(relations = DataFrame(element = character(0), set =
  character(0), membership = numeric(0)), ...)

Arguments

relations

DataFrame. At least 3 columns that provide mapping relationships between "element" and "set" identifiers, with "membership" function in the range [0,1]. Additional columns are taken as relation metadata.

...

Arguments passed to the Sets() constructor and other functions.

Value

A FuzzySets object.

Details

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

See also

Examples

# 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)
#> Setting rownames(relations) to NULL
# 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)
#> [1] 0.1 0.2 0.3 0.4 0.5 0.8
fs1 <- fs membership(fs1) <- runif(length(fs1))