Learn R Programming

RMark (version 3.0.0)

collect.model.names: Collect names of MARK model objects from list of R objects (internal function)

Description

Either names of all mark model objects (type=NULL) or names of mark model objects of a specific type (type) are extracted from a vector of R objects (lx) that was collected from the parent environment (frame) of the function that calls collect.model.names. Thus, it is two frames back (parent.frame(2)).

Usage

collect.model.names(lx, type = NULL, warning = TRUE)

Value

model.list: a vector of mark model names

Arguments

lx

vector of R object names from parent.frame(2)

type

either NULL (for all types) or a character model type (eg "CJS")

warning

if TRUE warning given when models of different types are collected

Author

Jeff Laake

Details

If type=NULL then the names of all objects of class(x)[1]="mark" in lx are returned. If type is specified, then the names of all objects of class(x)=c("mark",type) in lx are returned.

This function was written with the intention that it would be called from other functions ( e.g., collect.models, run.models) but it will work if called directly (e.g., collect.model.names( lx=ls())). While this function returns a vector of model names, collect.models returns a list of model objects. The latter can be used to easily create a list of models created in a function to be used as a return value without listing all the names of the functions. It uses collect.model.names to perform that function.

See Also

collect.models, run.models, model.table