Make a single-session capthist object from a list of single-session objects, or a multi-session capthist object.
1 2 3 4 5 6 7
list of single-session objects, or a multi-session
capthist object [
logical; if TRUE then a single record is retained for each trap site used in multiple input sessions
absolute distance in metres within which sites are considered identical
logical; if TRUE and
logical; if TRUE then site information is discarded
vector of times between sessions (join) or occasions (unjoin; zero indicates same session)
vector of session names
character vector of covariate names
other arguments passed to
The input sessions are assumed to be of the same detector type and to have the same attributes (e.g., covariates should be present for all or none).
The number of occasions (columns) in the output is equal to the sum of the number of occasions in each input.
Duplicates may be defined either as sites within a given distance (
tol) or sites with the same name (
sites.by.name = TRUE). Using site names is faster.
For non-spatial analyses it is efficient to drop the third dimension and discard the traps attribute (
drop.sites = TRUE).
A new dataframe of individual covariates is formed using the covariates for the first occurrence of each animal.
timevaryingcov is given then for each name a new covariate is generated for each session and populated with values observed in that session, or NA if the animal was not detected. A ‘timevaryingcov’ (list) attribute is created that associates each set of new session-specific columns with the corresponding old name, so that it may be used in formulae (see
Attributes xy and signal are handled appropriately, as is trap usage.
The input grouping of occasions (columns) into sessions is specified via
intervals. This is a vector of length one less than the number of
occasions (columns) in
object. Elements greater than zero
indicate a new session.
intervals argument may be omitted if
object has a
valid ‘intervals’ attribute, as in the output from
join, a single-session capthist object. The vector attribute ‘intervals’ records the
distinction between occasions that are adjacent in the input (interval =
0) and those that are in consecutive sessions (e.g., interval = 1); ‘intervals’
has length one less than the number of occasions.
unjoin, a multi-session capthist object. Sessions are named
Do not confuse
splits by row (animal) rather than by column (occasion).
Occasions survive intact; to pool occasions use
join was modified in version 2.9.5 to check whether the
components of ‘object’ all used the same detectors (‘traps’) (putting
aside differences in usage). If the traps are identical and
remove.dupl.sites = TRUE then the resulting ‘capthist’ uses the common list of
detectors, with a usage attribute formed by concatenating the usage
columns of the input. This is faster than the previous filtering
algorithm using ‘tol’; the older algorithm is still used if the traps differ.
Problems may be encountered with large datasets. These may be alleviated by setting sites.by.name = TRUE (if matching sites have matching names, avoiding the need for coordinate matching) or drop.sites = TRUE (if only non-spatial data are required for openCR).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
joined.ovenCH <- join (ovenCH) summary(joined.ovenCH) attr(joined.ovenCH, "intervals") summary(unjoin(joined.ovenCH)) ## Not run: ## suppose the 5-year ovenbird covariates include a column for weight ## (here generated as random numbers) for (i in 1:5) covariates(ovenCH[[i]])$wt <- runif(nrow(ovenCH[[i]])) ## construct single-session version of data for openCR ## identify 'wt' as varying across years ovenCHj <- join(ovenCH, timevaryingcov = 'wt') head(covariates(ovenCHj)) timevaryingcov(ovenCHj) ## Use example: openCR.fit(ovenCHj, model = p~wt) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.