Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

repro_stages

Identify which stages in a matrix population model are reproductive


Description

Takes a reproductive matrix and returns a vector of logical values (TRUE/FALSE) indicating which stages are reproductive (i.e. exhibit any positive values for reproduction). This function is a preparatory step to collapsing the matrix model into a standardized set of stage classes using the function mpm_standardize.

Usage

repro_stages(matR, na_handling = "return.true")

Arguments

matR

The reproductive component of a matrix population model (i.e. a square projection matrix reflecting transitions due to reproduction; either sexual (e.g. matF), clonal (e.g. matC), or both).

na_handling

One of "return.na", "return.true", or "return.false". Determines how values of NA within matR should be handled. See Value for more details.

Value

A logical vector of length ncol(matR), with values of FALSE corresponding to non-reproductive stages and values of TRUE corresponding to reproductive stages.

For a given matrix stage (i.e. column of matR), if there are any positive values of reproduction, the function will return TRUE. However, for a given stage, if there are no positive values of reproduction and one or more values of NA, the function will return NA if na_handling == "return.na", TRUE if na_handling == "return.true", or FALSE if na_handling == "return.false".

Author(s)

Rob Salguero-Gomez <rob.salguero@zoo.ox.ac.uk>

Patrick Barks <patrick.barks@gmail.com>

See Also

Examples

matR1 <- rbind(c( 0, 0.2,   0, 0.5),
               c( 0, 0.3,   0, 0.6),
               c( 0,   0,   0,   0),
               c( 0,   0,   0,   0))

matR2 <- rbind(c(NA,  NA,  NA, 1.1),
               c( 0,   0, 0.3, 0.7),
               c( 0,   0,   0,   0),
               c( 0,   0,   0,   0))

repro_stages(matR1)

# compare different methods for handling NA
repro_stages(matR2, na_handling = "return.na")
repro_stages(matR2, na_handling = "return.true")
repro_stages(matR2, na_handling = "return.false")

Rage

Life History Metrics from Matrix Population Models

v1.0.0
GPL-3
Authors
Patrick Barks [aut] (<https://orcid.org/0000-0002-5947-8151>), Danny Buss [ctb], Pol Capdevila [aut] (<https://orcid.org/0000-0002-2842-4302>), Hal Caswell [aut] (<https://orcid.org/0000-0003-4394-6894>), Judy P. Che-Castaldo [aut] (<https://orcid.org/0000-0002-9118-9202>), John Jackson [aut] (<https://orcid.org/0000-0002-4563-2840>), Tamora James [aut] (<https://orcid.org/0000-0003-1363-4742>), Owen Jones [aut, cre] (<https://orcid.org/0000-0001-5720-4686>), Sam Levin [aut] (<https://orcid.org/0000-0002-3289-9925>), William K. Petry [aut] (<https://orcid.org/0000-0002-5230-5987>), Roberto Salguero-Gomez [aut] (<https://orcid.org/0000-0002-6085-4433>), Caroline Schuette [ctb] (<https://orcid.org/0000-0002-2063-8736>), Iain Stott [aut] (<https://orcid.org/0000-0003-2724-7436>), Chelsea C. Thomas [aut] (<https://orcid.org/0000-0002-8155-9353>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.