R/repro_stages.R
repro_stages.Rd
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
.
repro_stages(matR, na_handling = "return.true")
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).
One of "return.na"
, "return.true"
, or
"return.false"
. Determines how values of NA
within
matR
should be handled. See Value for more details.
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"
.
Other transformation:
is_leslie_matrix()
,
leslie_collapse()
,
mpm_collapse()
,
mpm_rearrange()
,
mpm_split()
,
mpm_standardize()
,
name_stages()
,
standard_stages()
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)
#> [1] FALSE TRUE FALSE TRUE
# compare different methods for handling NA
repro_stages(matR2, na_handling = "return.na")
#> [1] NA NA TRUE TRUE
repro_stages(matR2, na_handling = "return.true")
#> [1] TRUE TRUE TRUE TRUE
repro_stages(matR2, na_handling = "return.false")
#> [1] FALSE FALSE TRUE TRUE