RaggedInteger: RaggedInteger Class

RaggedIntegerR Documentation

RaggedInteger Class

Description

This is a ragged array which stores integers (numeric values).

Methods

Public methods


Method new()

Create a new RaggedInteger

Usage
RaggedInteger$new(initial_values)
Arguments
initial_values

a vector of the initial values for each individual


Method get_values()

Get the variable values.

Usage
RaggedInteger$get_values(index = NULL)
Arguments
index

optionally return a subset of the variable vector. If NULL, return all values; if passed an [individual::Bitset] or integer vector, return values of those individuals.


Method get_length()

Get the lengths of the indiviudal elements in the ragged array

Usage
RaggedInteger$get_length(index = NULL)
Arguments
index

optionally only get lengths for a subset of persons. If NULL, return all lengths; if passed an [individual::Bitset] or integer vector, return lengths of arrays for those individuals.


Method queue_update()

Queue an update for a variable. There are 4 types of variable update:

  1. 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.

  2. 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.

  3. 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

  4. 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.

Usage
RaggedInteger$queue_update(values, index = NULL)
Arguments
values

a list of numeric vectors

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 an [individual::Bitset].


Method queue_extend()

extend the variable with new values

Usage
RaggedInteger$queue_extend(values)
Arguments
values

to add to the variable


Method queue_shrink()

shrink the variable

Usage
RaggedInteger$queue_shrink(index)
Arguments
index

a bitset or vector representing the individuals to remove


Method size()

get the size of the variable

Usage
RaggedInteger$size()

Method .update()

Usage
RaggedInteger$.update()

Method .resize()

Usage
RaggedInteger$.resize()

Method clone()

The objects of this class are cloneable with this method.

Usage
RaggedInteger$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


individual documentation built on July 15, 2022, 5:06 p.m.