StringSet | R Documentation |
This is a concstructor for the internal C-level String Set data structure. This can be thought of as an unordered character vector with a length and facilities for indexing.
Since a string set is a set, the order of the elements is not meaningful. However the indexing facilities can be useful, for example, when sampling where the order is not important, but consistent across calls.
StringSet(..., class = "StringSet", .els = as.character(unlist(list(...))))
... |
one or more character vectors. These are are combined into one large character vector
to be used to construct the set. This allows one to make calls like
|
class |
the name of the class of which we want an instance. Being able to specify this allows the caller to use this function as a constructor for derived classes. |
.els |
a character vector giving the elements for the set. This is a more convenient form than ... if the values are already in a vector. |
This creates an object in C from the libstree library and returns a reference to it.
An object of class StringSet-class
.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
http://www.cl.cam.ac.uk/~cpk25/libstree/libstree http://www.omegahat.org/Rlibstree
SuffixTree-methods
StringSet-class
getLongestSubstring
words = c("stemming", "boing", "springs")
set = StringSet(words)
length(set)
set[sample(1:3, 1)]
# Appending values to the set
# Note that we don't have to re-assign the value.
append(set, c("a", "b", "c"))
length(set)
lapply(set, function(x) x)
sapply(set, function(x) x)
sapply(set, getNativeSymbolInfo("R_LST_elementAsRString"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.