makespmdata | R Documentation |
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).
makespmdata(indata, yearcol = "year", catchcol = "catch", cpuecol = "cpue")
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 |
a matrix of class 'spmdat', which has the correct formatting for use with the spm related functions in datalowSA
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.