DoubleVariable | R Documentation |
Represents a continuous variable for an individual.
new()
Create a new DoubleVariable.
DoubleVariable$new(initial_values)
initial_values
a numeric vector of the initial value for each individual.
get_values()
get the variable values.
DoubleVariable$get_values(index = NULL)
index
optionally return a subset of the variable vector. If
NULL
, return all values; if passed a Bitset
or integer vector, return values of those individuals.
get_index_of()
return a Bitset
giving individuals
whose value lies in an interval [a,b].
DoubleVariable$get_index_of(a, b)
a
lower bound
b
upper bound
get_size_of()
return the number of individuals whose value lies in an interval Count individuals whose value lies in an interval [a,b].
DoubleVariable$get_size_of(a, b)
a
lower bound
b
upper bound
queue_update()
Queue an update for a variable. There are 4 types of variable update:
Subset update: The argument index
represents a subset of the variable to
update. The argument values
should be a vector whose length matches the size of index
,
which represents the new values for that subset.
Subset fill: The argument index
represents a subset of the variable to
update. The argument values
should be a single number, which fills the specified subset.
Variable reset: The index vector is set to NULL
and the argument values
replaces all of the current values in the simulation. values
should be a vector
whose length should match the size of the population, which fills all the variable values in
the population
Variable fill: The index vector is set to NULL
and the argument values
should be a single number, which fills all of the variable values in
the population.
DoubleVariable$queue_update(values, index = NULL)
values
a vector or scalar of values to assign at the index.
index
is the index at which to apply the change, use NULL
for the
fill options. If using indices, this may be either a vector of integers or
a Bitset
.
queue_extend()
extend the variable with new values
DoubleVariable$queue_extend(values)
values
to add to the variable
queue_shrink()
shrink the variable
DoubleVariable$queue_shrink(index)
index
a bitset or vector representing the individuals to remove
size()
get the size of the variable
DoubleVariable$size()
.update()
DoubleVariable$.update()
.resize()
DoubleVariable$.resize()
clone()
The objects of this class are cloneable with this method.
DoubleVariable$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.