makespmdata: makespmdata puts together correctly formatted data for SPM...

View source: R/spm.r

makespmdataR Documentation

makespmdata puts together correctly formatted data for SPM analysis

Description

makespmdata takes an input data set and out of it puts together the three vectors of the years, the catch, and the CPUE, in that order, to be analysed using surplus production modelling. The output matrixc is put into a suitable format, having column headings 'year', 'catch', and 'cpue' and gives it the class spmdat (which has a plot method).

Usage

makespmdata(indata, yearcol = "year", catchcol = "catch", cpuecol = "cpue")

Arguments

indata

either the list obtained from readdata or the data.frame 'fish' from with the list obtained from readdata. Alternatively a simple matrix containing at least vectors of year, catch, and cpue with those column headings.

yearcol

the column name of the column containng the years

catchcol

the column name of the column containng the catch data

cpuecol

the column name of the column containng the cpue data

Value

a matrix of class 'spmdat', which has the correct formatting for use with the spm related functions in datalowSA

Examples

## Not run: 
yrs <- 2000:2010
catches <- rnorm(length(yrs),mean=150,sd=5)
ce <- rnorm(length(yrs),mean=20,sd=1)
makemat <- cbind(year=yrs,catch=catches,cpue=ce)
dat <- makespmdata(makemat)
dat

## End(Not run)

haddonm/datalowSA documentation built on Nov. 5, 2023, 6:40 p.m.