| binCovariate | R Documentation |
Forms a new covariate, replacing values of an old numeric covariate either by the
central value of equal-width bins (a new numeric covariate) or factor levels from cut.
binCovariate(object, covname, width, breaks = NULL, replace = FALSE, ...)
object |
secr object with covariates attribute (capthist, traps, mask) |
covname |
character name of covariate |
width |
numeric bin width |
breaks |
numeric (see |
replace |
logical; if TRUE any existing covariate of the new name is replaced |
... |
arguments passed to cut when breaks is provided |
Argument ‘width’ is ignored if ‘breaks’ is specified.
By default (breaks not specified) the name of the new covariate is paste0(covname, width).
Otherwise, the new covariate name is paste0(covname, 'cut').
Fails if covariate not found or is not numeric or there is already a covariate with the new name and replace = FALSE.
Multi-session objects are handled appropriately.
Object of the same class as the input with new covariate.
covariates, skink
# bin values of skink snout-vent length (mm)
infraCH <- binCovariate (infraCH, 'SVL', 5)
table(covariates(infraCH[[1]])$SVL5)
# bin values of trap covariate 'HtBrack' (height of bracken, cm)
traps(infraCH) <- binCovariate(traps(infraCH), "HtBrack", 20)
table(covariates(traps(infraCH)[[1]])$HtBrack20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.