Description Details Public fields Methods
An indexed vector
A vector that remembers its original indices.
values
vector values
indices
vector indices
new()
Create a new IndexedVector
object.
IndexedVector$new(values, indices = NULL)
values
a vector of values
indices
optional vector of indices. If not provided, seq_along(values)
is used.
a new IndexedVector
object
subset()
Subset the vector
IndexedVector$subset(indices)
indices
indices specifying elements to extract
This is a standard subsetting, i.e., 1
returns the first element of the vector, not the one
belonging to the first index.
Note that since IndexedVector
is an R6 object, this modifies the vector in place.
min()
A minimum of vector
IndexedVector$min()
Method that calculate a minimum of vector values
minimum of vector values
which_min()
Find indices of minimum values
IndexedVector$which_min(minimum = NULL)
minimum
optional min a precalculated minimum.
Find which values are minimum values. Returns vector current (not original) indices
current indices that have the minimum value
substract()
Substract values from vector
IndexedVector$substract(vec)
vec
that is substracted from IndexedVector values
Substract values from vector, equivalent to calling IndexedVector$values - vec
len()
Get length of the vector
IndexedVector$len()
equivalent to calling length(IndexedVector$values)
length of the IndexedVector
sum()
Sum of the vector values
IndexedVector$sum()
equivalent to calling sum(IndexedVector$values)
the sum of the IndexedVector
clone()
The objects of this class are cloneable with this method.
IndexedVector$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.