Package 'icesASD'

Title: Advice and Scenarios Database Web Services
Description: R interface to access the web services of the ICES Advice and Scenarios database <https://asd.ices.dk/AdviceList>.
Authors: Colin Millar [aut, cre], Luca Lamoni [aut], Carlos Pinto [aut], Laura Petre [aut], David Miller [ctb], Neil Maginis [ctb]
Maintainer: Colin Millar <[email protected]>
License: GPL (>= 2)
Version: 0.0.2
Built: 2026-06-02 08:42:39 UTC
Source: https://github.com/ices-tools-prod/icesASD

Help Index


Stock Advice and Scenarios Database Web Services

Description

R interface to access the web services of the ICES Stock Advice and Scenarios database.

Details

Get dataset:

getAdviceViewRecord Get Advice Record
getCatchScenariosTable Get Advice Catch Scenario Table
getCatchScenariosNotes Get Advice Catch Scenario Table Footnotes

Author(s)

Colin Millar, Luca Lamoni, Carlos Pinto, Laura Petre, David Miller and Neil Maginis.

References

ICES Advice and Scenarios database: http://sg.ices.dk.

ICES Advice and Scenarios database web services: http://sg.ices.dk/webservices.aspx.


Download advice scenarios

Description

Download a zip file of a set of advice scenarios

Usage

adviceDownload(adviceKeys, dir = ".")

Arguments

adviceKeys

a vector of advice view ids.

dir

directory to download to.

Examples

## Not run: 
adviceDownload(c(1009, 1011, 1022))

## End(Not run)

Create The ASD Webservice URL

Description

utility to build a url with optional query arguments

Usage

asd_api(service, ...)

Arguments

service

the name of the service

...

named arguments will be added as queries

Value

a complete url as a character string

Examples

asd_api("hi", bye = 21)
asd_api("csquares", argument1 = 2021, argument2 = NULL)

Check catch scenario notes in a browser

Description

Check catch scenario notes in a browser

Usage

checkNotes(notes)

Arguments

notes

df of culumns element of catch scenario table

Examples

## Not run: 
data(scenarioNotes)
checkNotes(scenarioNotes)

## End(Not run)

Check catch scenario table in a browser

Description

Check catch scenario table in a browser

Usage

checkTable(columns, rows, values)

Arguments

columns

df of culumns element of catch scenario table

rows

df of rows element of catch scenario table

values

df of values element of catch scenario table

Examples

data(scenarioColumns)
data(scenarioRows)
data(scenarioValues)
checkTable(scenarioColumns, scenarioRows, scenarioValues)

Create the XML format for catch scenario data

Description

Create the XML format for catch scenario data

Usage

createASDxml(
  info,
  scenarioColumns,
  scenarioRows,
  scenarioValues,
  scenarioNotes
)

Arguments

info

details

scenarioColumns

details

scenarioRows

details

scenarioValues

details

scenarioNotes

details

Examples

## Not run: 
checkTable(col, rows, vals)

## End(Not run)

Get Advice Catch Scenario Table

Description

Returns the catch scenario table for the selected stock and year using the advice view web service.

Usage

get_catch_scenario_table(adviceKey, assessmentYear)

Arguments

adviceKey

integer value of stock adviceKey

assessmentYear

integer value of assessment year

Value

data.frame containing the catch scenarios table for the advice view record

References

https://sg.ices.dk/adviceview/AdviceList

Examples

get_catch_scenario_table(3056,2022)

Get Advice View Record

Description

Get Advice View Record

Usage

getAdviceViewRecord(stockcode = NULL, year = NULL, assessmentKey = NULL)

Arguments

stockcode

string value of the stock code you wish to look

year

integer value of assessment year

assessmentKey

integer value of SAG assessmentKey

Examples

catch_scenario_list <- getAdviceViewRecord()
head(catch_scenario_list, 3)

getAdviceViewRecord("bll.27.3a47de", 2021, 15609)

Get Any ASD Data

Description

This function combines the functionality of getListStocks, getFishStockReferencePoints, getSummaryTable and getStockDownloadData. It supports querying many stocks and years in one function call.

Usage

getASD(
  stock = NULL,
  year = NULL,
  assessmentKey = NULL,
  outputData = "table",
  purpose = "Advice"
)

Arguments

stock

a stock name, e.g. cod-347d, or cod to find all cod stocks, or NULL to process all stocks.

year

the assessment year, e.g. 2015, or 0 to process all years.

assessmentKey

the assessmentKey of the stock of interest.

outputData

the data you want to retrieve, either "table", "record", or "notes".

purpose

the purpose of the entry, options are "Advice", "Bench", "InitAdvice", default is "Advice".

Value

A data frame (default) or a list if combine is TRUE.

Note

Only years with "Published" status are returned.

Author(s)

Luca Lamoni.

See Also

getListStocks

findAssessmentKey finds lookup keys.

icesSAG-package gives an overview of the package.

Examples

## Not run: 
# Example usage
getASD(stock = "cod.27.7e-k", year = 2023, outputData = "record")
# Example usage with assessmentKey
getASD(assessmentKey = 18719, outputData = "table")

## End(Not run)

Get Catch Scenarios Notes

Description

Get Catch Scenarios Notes for a given record

Usage

getCatchScenariosNotes(adviceKey)

Arguments

adviceKey

advice view id(s)

Examples

catch_scenario_note <- getCatchScenariosNotes(2814)
catch_scenario_notes <- getCatchScenariosNotes(c(2814, 2815))

Get Catch Scenarios Table

Description

Get Catch Scenarios Table for a given record

Usage

getCatchScenariosTable(adviceKey)

Arguments

adviceKey

advice view id(s)

Examples

catch_scenario_table <- getCatchScenariosTable(2814)
catch_scenario_tables <- getCatchScenariosTable(c(2814, 2815))

Catch Scenario Datasets

Description

Predefined colors that can be useful in TAF plots.

Usage

info

Format

List containing four entries:

stockCode ICES fish stock code
AssessmentYear assessment year
Purpose assessment purpose
contact contact person

Details

The data are an excerpt from ...

Source

ICES (2024).


Read a file in the ASD upload format

Description

Read a file in the ASD upload format, returning a list of metadata and data.frame

Usage

readAsdUpload(filename, format = FALSE)

Arguments

filename

the file path of the file to read

format

should the output be formatted into an easy to read table

Examples

#filename <- system.file("CatchScenarios_AdviceKey_3207.xml", package = "icesASD")
#asd <- readAsdUpload(filename)

Catch Scenario Datasets

Description

Predefined colors that can be useful in TAF plots.

Usage

scenarioColumns

Format

List containing four entries:

stockCode ICES fish stock code
AssessmentYear assessment year
Purpose assessment purpose
contact contact person

Details

The data are an excerpt from ...

Source

ICES (2024).


Catch Scenario Datasets

Description

Predefined colors that can be useful in TAF plots.

Usage

scenarioNotes

Format

List containing four entries:

stockCode ICES fish stock code
AssessmentYear assessment year
Purpose assessment purpose
contact contact person

Details

The data are an excerpt from ...

Source

ICES (2024).


Catch Scenario Datasets

Description

Predefined colors that can be useful in TAF plots.

Usage

scenarioRows

Format

List containing four entries:

stockCode ICES fish stock code
AssessmentYear assessment year
Purpose assessment purpose
contact contact person

Details

The data are an excerpt from ...

Source

ICES (2024).


Catch Scenario Datasets

Description

Predefined colors that can be useful in TAF plots.

Usage

scenarioValues

Format

List containing four entries:

stockCode ICES fish stock code
AssessmentYear assessment year
Purpose assessment purpose
contact contact person

Details

The data are an excerpt from ...

Source

ICES (2024).


Screen an ASD file and submit for QC checks

Description

In this web service the user can upload a file to be screen and validated by the VMS database. The service can be called using post and the file will have to be part of the body of the call. The user needs to be authenticated in order to call this service. This file can be later pushed to the database by the same user.

Usage

screen_asd_file(file, verbose = FALSE)

Arguments

file

file name of the file containing the data to screen

verbose

return verbose information about the POST request

Value

text message from the screening process