addcount: addcount adds a count of years and avC to a data.frame

View source: R/cpuefuncs.r

addcountR Documentation

addcount adds a count of years and avC to a data.frame

Description

addcount given an input data.frame containing catch, diver, and year as variables this function first sums the catch by diver, by year, then counts each diver's occurrence across the years, and each diver's catch. Then stepping through each diver it populates two new colummns named 'count' and 'avC'.

Usage

addcount(indat, varid = "diver", group = "year", catch = "catch")

Arguments

indat

a data.frame containing at least columns named 'catch', 'diver' (or in fact 'varid'), and 'year'.

varid

the variable in the data.frame for which the count and average catch per year is to be estimated. Defaults to 'diver' ready for abalone data but could be vessel for other fisheries, or any other factor of interest.

group

the first grouping variable, typically diver ifor abalone

catch

the variable name for the catch, sometimes blip in abalone

Value

a data.frame made of the input data.frame plus two new columns


haddonm/rforcpue documentation built on Oct. 12, 2024, 11:55 p.m.