binCovariate {secr}R Documentation

Add Binned Covariate

Description

Forms a new covariate, replacing values of an old covariate by the central value of equal-width bins.

Usage


binCovariate(object, covname, width)

Arguments

object

secr object with covariates attribute (capthist, traps, mask)

covname

character name of covariate

width

numeric bin width

Details

The name of the new covariate is paste0(covname, width).

Fails if covariate not found or is not numeric or there is already a covariate with the new name.

Multi-session objects are handled appropriately.

Value

Object of the same class as the input with new covariate.

See Also

covariates, skink

Examples


# 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)


[Package secr version 4.6.6 Index]