uploadStock: Upload New or Updated Fish Stock Assessment Results

View source: R/uploadStock.R

uploadStockR Documentation

Upload New or Updated Fish Stock Assessment Results

Description

Get summary results of historical stock size, recruitment, and fishing pressure.

Usage

uploadStock(file, upload = FALSE, verbose = FALSE)

Arguments

file

the xml file to check and upload

upload

should the file be uploaded to the database? Default is FALSE.

verbose

if TRUE more verbose messages are reported

Value

The database key of the new / updated stock, or 0 if there was an error.

Author(s)

Colin Millar.

See Also

stockInfo creates a list of stock information.

stockFishdata creates a data.frame of fish stock summary data.

Examples

## Not run: 
info <-
stockInfo(
  StockCode = "whb-comb",
  AssessmentYear = 1996,
  ContactPerson = "its_me@somewhere.gov",
  StockCategory = 3,
  Purpose = "InitAdvice",
  ModelType = "A",
  ModelName = "XSA"
)
fishdata <- stockFishdata(1950:1996)
# simulate some landings for something a bit intesting
set.seed(1232)
fishdata$Landings <- 10^6 * exp(cumsum(cumsum(rnorm(nrow(fishdata), 0, 0.1))))

# You should write out to an xml file and then upload that file
tempfile <- tempfile(fileext = ".xml")
writeSAGxml(info, fishdata, file = tempfile)

# you can check the file is formatted correctly
uploadStock(tempfile, upload = FALSE)

# and if all checks pass, the file can be uploaded
uploadStock(tempfile, upload = TRUE)

## End(Not run)



icesSAG documentation built on June 8, 2025, 10:29 a.m.