Adds columns to the data slot of a CompadreDB object that flag potential problems in the matrix population models. These columns can subsequently be used to subset the database by logical argument.

Optional checks include:

  • check_NA_A: missing values in matA?

  • check_NA_U: missing values in matU?

  • check_NA_F: missing values in matF?

  • check_NA_C: missing values in matC?

  • check_zero_U: matU all zeros (including NA)?

  • check_singular_U: matU singular (i.e. non-invertable)?

  • check_component_sum: do matU/matF/matC components sum to matA (see Details)?

  • check_ergodic: is matA ergodic (see isErgodic)?

  • check_irreducible: is matA irreducible (see isIrreducible)?

  • check_primitive: is matA primitive (see isPrimitive)?

cdb_flag(cdb, checks = c("check_NA_A", "check_NA_U", "check_NA_F",
  "check_NA_C", "check_zero_U", "check_singular_U", "check_component_sum",
  "check_ergodic", "check_irreducible", "check_primitive"))



A CompadreDB object


Character vector specifying which checks to run.

Defaults to all, i.e. c("check_NA_A", "check_NA_U", "check_NA_F", "check_NA_C", "check_zero_U", "check_singular_U", "check_component_sum", "check_ergodic", "check_irreducible", "check_primitive")


Returns cdb with extra columns appended to the data slot (columns have the same names as the corresponding elements of checks) to indicate (TRUE/FALSE) whether there are potential problems with the matrices corresponding to a given row of the data.


For the flag check_component_sum, a value of NA will be returned if the matrix sum of matU, matF, and matC consists only of zeros and/or NA, indicating that the matrix has not been split.


CompadreFlag <- cdb_flag(Compadre) # only check whether matA has missing values, and whether matA is ergodic CompadreFlag <- cdb_flag(Compadre, checks = c("check_NA_A", "check_ergodic"))