AIprep: Prepare the Adult Index Data

View source: R/AIprep.R

AIprepR Documentation

Prepare the Adult Index Data

Description

Read in the adult sea lamprey trapping data (collected for estimation of the Adult Index) and prepare it for estimation.

Usage

AIprep(
  csvDir,
  csvNew,
  csvOld = NULL,
  streamInfo = trappedStreams,
  indexStreams = lsIndex,
  keepStreams = lsKeep
)

Arguments

csvDir

A character scalar identifying the path where the csv files are stored, e.g., csvDir = "C:\temp\mydir".

csvNew

A character scalar identifying the name of the csv file with stream mark-recapture estimates for which Adult Indices will be estimated (typically from the current year). The first row of the csv file should be column headers and must include: year, lake, lake-stream ID lscode (see details), population estimate PEmr, coefficient of variation CVmr (100% * sqrt(variance(PEmr)) / PEmr). See details.

csvOld

A character scalar identifying the name of the csv file with stream mark-recapture estimates for which Adult Indices have already been estimated (typically from previous years), with the same variables as in csvNew plus the previously estimated contributions indexContrib and indexContribCV, default NULL. See details.

streamInfo

A data frame with stream information to be combined with the estimates data (csvNew and csvOld), default trappedStreams. Set to NULL if you don't want any stream information to be brought in.

indexStreams

Lake-stream IDs identifying index streams, default lsIndex.

keepStreams

Lake-stream IDs identifying streams which will continue to have ongoing trapping even if not part of the Adult Index, default lsKeep.

Details

Lake-stream IDs are combination of lake ID and stream ID e.g., 1.064 = lake ID + (stream ID)/1000.

For both estimate files (csvNew and csvOld), there should be no missing values in year, lake, or lscode. Both files may contain variables other than those required. Those with the same name as variables in streamInfo will be replaced. Others will be kept.

Value

A single data frame that contains the information from all of the inputs, including new variables: index, a logical identifying the index streams; maintain a logical identifying the streams that will continue to have ongoing trapping even if not part of the Adult Index; indexContrib a numeric, the stream population estimate that will be used in the Adult Index (NA for csvNew); indexContribCV a numeric, the stream CV that will be used to generate 95% confidence intervals for the Adult Index (NA for new); and complete a logical identifying streams and years for which the Adult Index has already been estimated (FALSE for csvNew).


JVAdams/GLFC documentation built on Jan. 5, 2023, 12:59 a.m.