| Set | R Documentation |
This class implements the data structure and methods for fuzzy sets.
new()Creator for objects of class Set
Set$new(attributes, M = NULL, ...)
attributes(character vector) Names of the attributes that will be available in the fuzzy set.
M(numeric vector or column Matrix) Values (grades) to be assigned to the attributes.
...key = value pairs, where the value value is assigned to the key attribute name.
If M is omitted and no pair key = value, the fuzzy set is the empty set. Later, one can use the assign method to assign grades to any of its attributes.
An object of class Set.
assign()Assign grades to attributes in the set
Set$assign(attributes = c(), values = c(), ...)
attributes(character vector) Names of the attributes to assign a grade to.
values(numeric vector) Grades to be assigned to the previous attributes.
...key = value pairs, where the value value is assigned to the key attribute name.
One can use both of:
S$assign(A = 1, B = 0.3)
S$assign(attributes = c(A, B), values = c(1, 0.3)).
[()Get elements by index
Set$[(indices)
indices(numeric, logical or character vector) The indices of the elements to return. It can be a vector of logicals where TRUE elements are to be retained.
A Set but with only the required elements.
cardinal()Cardinal of the Set
Set$cardinal()
the cardinal of the Set, counted
as the sum of the degrees of each element.
get_vector()Internal Matrix
Set$get_vector()
The internal sparse Matrix representation of the set.
get_attributes()Attributes defined for the set
Set$get_attributes()
A character vector with the names of the attributes.
length()Number of attributes
Set$length()
The number of attributes that are defined for this fuzzy set.
print()Prints the set to console
Set$print(eol = TRUE)
eol(logical) If TRUE, adds an end of line to the output.
A string with the elements of the set and their grades between brackets .
to_latex()Write the set in LaTeX format
Set$to_latex(print = TRUE)
print(logical) Print to output?
The fuzzy set in LaTeX.
clone()The objects of this class are cloneable with this method.
Set$clone(deep = FALSE)
deepWhether to make a deep clone.
S <- Set$new(attributes = c("A", "B", "C"))
S$assign(A = 1)
print(S)
S$to_latex()
S <- Set$new(c("A", "B", "C"), C = 1, B = 0.5)
S
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.