extract-TidySet {BaseSet} | R Documentation |
Extract
Description
Operators acting on TidySet to extract or replace parts. They are designed to resemble the basic operators.
Usage
## S4 method for signature 'TidySet'
x$name
## S4 replacement method for signature 'TidySet'
x$name <- value
## S4 method for signature 'TidySet'
x[i, j, k, ..., drop = TRUE]
## S4 replacement method for signature 'TidySet'
x[i, j, k, ...] <- value
## S4 method for signature 'TidySet'
x[[i, j, ..., exact = TRUE]]
## S4 replacement method for signature 'TidySet'
x[[i]] <- value
Arguments
x |
A TidySet object. |
name |
The data about the TidysSet object to extract. |
value |
The value to overwrite |
i |
Which rows do you want to keep? By default all. |
j |
Which slot do you want to extract? One of "sets", "elements" or "relations". |
k |
Which columns do you want to extract. By default all. |
... |
Other arguments currently ignored. |
drop |
Remove remaining elements, sets and relations? Passed to all
arguments of |
exact |
A logical value. FALSE if fuzzy matching is wanted. Add values to the TidySet. Allows to control to which slot is it added. |
Value
Always returns a valid TidySet.
Examples
TS <- tidySet(list(A = letters[1:5], B = letters[6]))
TS[, "sets", "origin"] <- sample(c("random", "non-random"), 2, replace = TRUE)
TS[, "sets", "type"] <- c("Fantastic", "Wonderful")
# This produces a warning
# Better to be explicit:
TS[, "relations", "description"] <- c("What", "can", "I", "say", "now", "?")
relations(TS)
TS[, "elements", "description"] <- rev(c("What", "can", "I", "say", "now", "?"))
elements(TS)
# Which will be deleted?
# TS$description <- NULL
TS$type
TS$origin <- c("BCN", "BDN")
# Different subsets
TS[1, "elements"]
TS[1, "sets"]
# Always print
TS
TS[, "sets", c("type", "origin")] # Same
TS[, "sets", "origin"] # Drop column type
is(TS[, "sets", "origin"])
TS[, "sets"]
TS[["A"]]
TS[["B"]]
TS[["C"]] # Any other set is the empty set
[Package BaseSet version 0.9.0 Index]