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

sharefactorlevels

Fix Inconsistent Covariates


Description

Factor covariates can give trouble in multi-session models if the levels differ among sessions. A warning is provided by verify.capthist. This function forces factor covariates to use the same levels.

Usage

shareFactorLevels(object, columns = NULL, stringsAsFactors = TRUE)

Arguments

object

multi-session capthist object or list of traps or mask objects

columns

indices of columns to fix (default all)

stringsAsFactors

logical; if TRUE then character columns are converted to factor

Details

Factor-valued covariates are coerced to use the same set of levels for each session of a multi-session capthist object or each component of a list of traps or masks. The combined level set is the union of all levels in separate sessions. The order of levels follows the default in factor (alphabetical according to current locale).

Setting stringsAsFactors = TRUE causes character-valued columns to be converted to factors.

Value

An object of the same class as input. A single-session object is passed unchanged except for possible conversion of character values to factor (stringsAsFactors = TRUE).

See Also


secr

Spatially Explicit Capture-Recapture

v4.4.1
GPL (>= 2)
Authors
Murray Efford
Initial release
2021-05-01

We don't support your browser anymore

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