sam2taf {TAF} | R Documentation |
Convert SAM Table to TAF Format
Description
Convert a table from SAM format to TAF format.
Usage
sam2taf(x, colname = NULL, year = TRUE)
Arguments
x |
a matrix containing columns |
colname |
a descriptive column name for the output. |
year |
whether to include a year column. |
Details
The default when colname = NULL
is to try to infer a column name from
the x
argument. For example,
sam2taf(ssbtable(fit)) sam2taf(ssb) sam2taf(SSB)
will recognize ssbtable
calls and ssb
object names, implicitly
setting colname = "SSB"
if the user does not pass an explicit value
for colname
.
Value
A data frame in TAF format.
Note
The stockassessment package provides accessor functions that return a
matrix with columns Estimate
, Low
, and High
, while TAF
tables are stored as data frames with a year column.
See Also
summary.taf
describes the TAF format.
catchtable
, fbartable
, rectable
, ssbtable
, and
tsbtable
(in the stockassessment package) return matrices with
SAM estimates and confidence limits.
The summary
method for sam
objects produces a summary table
with some key quantities of interest, containing duplicated column names
(Low
, High
) and rounded values.
TAF-package
gives an overview of the package.
Examples
## Example objects
x <- as.matrix(summary.taf[grep("SSB", names(summary.taf))])
rec <- as.matrix(summary.taf[grep("Rec", names(summary.taf))])
tsb <- as.matrix(summary.taf[grep("TSB", names(summary.taf))])
dimnames(x) <- list(summary.taf$Year, c("Estimate", "Low", "High"))
dimnames(rec) <- dimnames(tsb) <- dimnames(x)
## One SAM table, arbitrary object name
sam2taf(x)
sam2taf(x, "SSB")
sam2taf(x, "SSB", year=FALSE)
## Many SAM tables, recognized names
sam2taf(rec)
data.frame(sam2taf(rec), sam2taf(tsb, year=FALSE))
## Not run:
## Accessing tables from SAM fit object
data.frame(sam2taf(rectable(fit)), sam2taf(tsbtable(fit), year=FALSE))
## End(Not run)