thinIterations {dembase}R Documentation

Reduce the number of iterations in demographic array.

Description

Given an object of class DemographicArray that has a dimension with dimtype "iteration", return a new object containing a subset of the original iterations.

Usage

thinIterations(object, n)

## S4 method for signature 'DemographicArray'
thinIterations(object, n)

Arguments

object

Object of class DemographicArray.

n

The number of iterations to retain.

Details

The n iterations to retain are chosen at random, and are numbered 1, 2, ..., n.

If object does not have a dimension with dimtype "iteration", thinIterations throws an error.

See Also

Other functions that can be used to subset a dimension with dimtype "iteration" are subarray, slab, and [. To remove an "iteration" dimension entirely, use collapseIterations.

Examples

x <- Counts(array(1:6,
                  dim = c(2, 3),
                  dimnames = list(sex = c("Female", "Male"), iteration = 1:3)))
thinIterations(x, n = 2)

[Package dembase version 0.0.0.119 Index]