nIteration {dembase} | R Documentation

## Get the number of iterations in a demographic array.

### Description

If an object of class `DemographicArray` has a dimension with `dimtype` `"iteration"`, return the lenth of that dimension; if not, raise an error.

### Usage

    nIteration(object)

    ## S4 method for signature 'DemographicArray'
    nIteration(object)

### Arguments

`object` | Object of class `DemographicArray`.

### Value

An integer.

### Author(s)

John Bryant demographic.packages@gmail.com

### See Also

`dimtypes`, `collapseIterations`

### Examples

    library(demdata)
    x <- Counts(array(replicate(n = 5, rnorm(2)),
                      dim = c(2, 5),
                      dimnames = list(sex = c("Female", "Male"),
                          iteration = 1:5)))
    nIteration(x)

    x <- Counts(VAPopn)
    ## no dimension with dimtype "iteration"
    ## Not run: nIteration(x)

[Package dembase version 0.0.0.119 Index]