indivsInfo_ExtractStartEndByStage: Extract info by individual at start and end of life or model...

View source: R/indivsInfo_ExtractStartEndByStage.R

indivsInfo_ExtractStartEndByStageR Documentation

Extract info by individual at start and end of life or model run

Description

Function to extract info by individual at start and end of life or model run.

Usage

indivsInfo_ExtractStartEndByStage(
  sf_start = NULL,
  sf_ebs = NULL,
  lst_indivs = NULL,
  startLHS = NULL,
  addVarsStart = "",
  addVarsEnd = "",
  hasSuccessful = FALSE,
  verbose = FALSE,
  checkCalcs = FALSE
)

Arguments

sf_start

- (optional) sf dataframe returned by indivsInfo_ExtractStart

sf_ebs

- (optional) sf dataframe returned by indivsInfo_ExtractEndByStage

lst_indivs

- (req'd if sf_start or sf_end is NULL) list of sf dataframes by life stage returned by indivsInfo_ReorderResults

startLHS

- (req'd if sf_start is NULL) life stage in which all individuals start

addVarsStart

- character vector with names of additional (non-default) start variables to extract

addVarsEnd

- character vector with names of additional (non-default) end variables to extract

hasSuccessful

- flag indicating that sf_start, sf_ebs, or lst_indivs include "successful" columns

verbose

- flag to print debugging info

checkCalcs

- flag (T/F) to check endGeom is correctly assigned (for debugging)

Details

The input sf dataframes sf_start and sf_end should be the output of indivsInfo_ExtractStart and indivsInfo_ExtractEnd, respectively. If both are given as an inputs, addVars is ignored.

If either are NULL, lst_indivs must be given. If sf_start is NULL, startLHS must be given. If sf_start is NULL, it is calculated internally using sf_start = indivsInfo_ExtractStart(lst_indivs[[startLHS]],addVars=addVars).

If sf_end is NULL, it is calculated internally using sf_ebs = indivsInfo_ExtractEndByStage(lst_indivs,addVars=addVars) followed by sf_end = indivsInfo_ExtractEnd(sf_ebs).

Value

sf dataframe with columns:

  • startTime

  • origID - original (starting) individual ID

  • startLHS - starting life stage

  • startGridCell - ID of starting ROMS grid cell

  • startLon - starting longitude

  • startLat - starting latitude

  • startDepth - starting depth (m)

  • startBathym - bathymetric depth (m) at starting location

  • startAge - starting depth

  • startNum - starting depth

  • start..AddVarsStart - starting values for additional (non-default) variables

  • startGeom - starting 2d location as SF_POINT

  • endTime - ending time

  • endID - ending individual ID

  • endLHS - ending life stage

  • endGridCell - ID of ending ROMS grid cell

  • endLon - ending longitude

  • endLat - ending latitude

  • endDepth - ending depth (m)

  • endBathym - bathymetric depth (m) at ending location

  • endAge - ending age(d)

  • endNum - ending number

  • end..AddVarsEnd - ending values for additional (non-default) variables

  • successful - flag indicating "success" (TRUE) or failure (FALSE) (e.g., settlement) [depends on inputs]

  • endGeom - ending 2d location as SF_POINT


wStockhausen/rDisMELS documentation built on March 27, 2022, 1 a.m.