create.varstructure: Creates structures needed to compute abundance and variance

View source: R/create.varstructure.R

create.varstructureR Documentation

Creates structures needed to compute abundance and variance


Creates samples and obs dataframes used to compute abundance and its variance based on a structure of geographic regions and samples within each region. The intent is to generalize this routine to work with other sampling structures.


create.varstructure(model, region, sample, obs,



fitted ddf object


region table


sample table


table of object #'s and links to sample and region table

is uncertainty going to be calculated later?


The function performs the following tasks: 1)tests to make sure that region labels are unique, 2) merges sample and region tables into a samples table and issue a warning if not all samples were used, 3) if some regions have no samples or if some values of Area were not valid areas given then issue error and stop, then an error is given and the code stops, 4) creates a unique region/sample label in samples and in obs, 5) merges observations with sample and issues a warning if not all observations were used, 6) sorts regions by its label and merges the values with the predictions from the fitted model based on the object number and limits it to the data that is appropriate for the fitted detection function.


List with 2 elements:


merged dataframe containing region and sample info - one record per sample


merged observation data and links to region and samples


Internal function called by dht


Jeff Laake

mrds documentation built on March 18, 2022, 5:26 p.m.