clone: Replicate Rows

Description Usage Arguments Details Value See Also Examples

View source: R/clone.R

Description

Clone rows of an object a constant or random number of times

Usage

1
2
3
4
5
6
  ## Default S3 method:
clone(object, type, ...)
  ## S3 method for class 'popn'
clone(object, type, ...)
  ## S3 method for class 'capthist'
clone(object, type, ...)

Arguments

object

any object

type

character 'constant', 'poisson' or 'nbinom'

...

other arguments for distribution function

Details

The ... argument specifies the number of times each row should be repeated. For random distributions (Poisson or negative binomial) ... provides the required parameter values: lambda for Poisson, size, prob or size, mu for negative binomial.

One application is to derive a population of cues from a popn object, where each animal in the original popn generates a number of cues from the same point.

Cloning a capthist object replicates whole detection histories. Individual covariates and detection-specific attributes (e.g., signal strength or xy location in polygon) are also replicated. Cloned data from single-catch traps will cause verify() to fail, but a model may still be fitted in secr.fit by overriding the check with verify = FALSE.

Value

Object of same class as object but with varying number of rows. For clone.popn and capthist an attribute ‘freq’ is set, a vector of length equal to the original number of rows giving the number of repeats (including zeros).

If popn or capthist is a multi-session object the returned value will be a multi-session object of the same length.

See Also

sim.popn

Examples

1
2
3
4
5
6
7
8
## population of animals at 1 / hectare generates random
## Poisson number of cues, lambda = 5
mics4 <- make.grid( nx = 2, ny = 2, spacing = 44, detector = "signal")
pop <- sim.popn (D = 1, core = mics4, buffer = 300, nsessions = 66)
pop <- clone (pop, "poisson", 5)
attr(pop[[1]],"freq")

clone(captdata, "poisson", 3)

secr documentation built on May 19, 2017, 10:32 p.m.

Search within the secr package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.