Package 'icesTAF'

Title: Functions to Support the ICES Transparent Assessment Framework
Description: Functions to support the ICES Transparent Assessment Framework <https://taf.ices.dk> to organize data, methods, and results used in ICES assessments. ICES is an organization facilitating international collaboration in marine science.
Authors: Colin Millar [aut, cre], Arni Magnusson [aut]
Maintainer: Colin Millar <[email protected]>
License: GPL-3
Version: 4.3.1
Built: 2026-05-20 07:37:08 UTC
Source: https://github.com/ices-tools-prod/icesTAF

Help Index


Functions to Support the ICES Transparent Assessment Framework

Description

Functions to support the ICES Transparent Assessment Framework, to organize data, methods, and results used in ICES assessments.

Author(s)

Colin Millar and Arni Magnusson.

References

ICES Transparent Assessment Framework: https://taf.ices.dk.

To explore example TAF stock assessments, see the introductory video and tutorial.

The TAF Wiki provides additional help resources.

See Also

Useful links:


Make an Artifact File Entry

Description

Form and validate an artifact as an export from a TAF repository.

Usage

artifact(path, type = c("adhoc", "FLStock", "SAG"), ..., check = TRUE,
  quiet = FALSE)

Arguments

path

The relative path to a file to be added, e.g. "data/indices.csv".

type

the type of output, e.g. FLStock, SAG_upload

...

a list of metadata to be attributed to the entry.

check

logical, should the artifact be checked for validity?

quiet

logical, should the function be quiet?

See Also

check.artifact write.artifacts

Examples

## Not run: 
sag_file <- system.file("SAG", "sol_27_4.xml", package = "icesTAF")
sag <- artifact(sag_file, type = "SAG", check = FALSE)
sag

# to check the artifact, use:
sag <- artifact(tmpfile, type = "SAG")
# or
check.artifact(sag)

## End(Not run)

Check an Artifact File Entry

Description

Validate an artifact as an export from a TAF repository.

Usage

check.artifact(artifact, check.metadata = TRUE, check.type = TRUE,
  quiet = FALSE)

Arguments

artifact

an artifact object made using artifact.

check.metadata

logical, should the metadata be checked against the ICES Vocabulary database?

check.type

logical, should type specific artifact checks be run?

quiet

logical, should the function be quiet?

Examples

## Not run: 
sag_file <- system.file("SAG", "sol_27_4.xml", package = "icesTAF")
sag <- artifact(sag_file, type = "SAG", check = FALSE)
check.artifact(sag)

## End(Not run)

Check boot data entries

Description

Check that all data entries in boot/DATA.bib are present in the boot/data folder

Usage

check.boot.data()

Value

logical vector indicating which entries are present (TRUE) or missing (FALSE)


Get a List of TAF Artifacts

Description

Get a list of TAF artifacts and their metadata, i.e., all the FLStocks, SAG upload files, RCEF files, and other files uploaded to TAF.

Usage

get.artifacts(year = NULL, stock = NULL, ...)

Arguments

year

the assessment year, e.g. 2015, default all years.

stock

a stock name, e.g. lin.27.5a, default all stocks.

...

arguments passed to taf_get.

Value

A data frame.

Author(s)

Colin Millar.

See Also

icesTAF-package gives an overview of the package.

Examples

## Not run: 
artifacts <- get.artifacts(2023)
nshad_artifacts <- get.artifacts(stock = "had.27.46a20")

## End(Not run)

Read an Artifact File

Description

Read and validate an artifact file.

Usage

read.artifacts(file = "ARTIFACTS.json", check = TRUE)

Arguments

file

the name of the artifacts file to read

check

logical, should the artifact be checked for validity?


Build a SAG web service url

Description

utility to build a url with optional query arguments

Usage

taf_api(service, ...)

Arguments

service

the name of the service

...

name arguments will be added as queries

Value

a complete url as a character string

Examples

taf_api("hi", bye = 21)
taf_api("FLStocks")

Get a url

Description

Get a url, optionally using an ICES authentication token

Usage

taf_get(url, retry = TRUE, quiet = getOption("icesTAF.messages") %||%
  FALSE, verbose = FALSE, content = TRUE,
  use_token = getOption("icesTAF.use_token") %||% FALSE)

taf_get_cached(url, retry = TRUE, quiet = getOption("icesTAF.messages")
  %||% FALSE, verbose = FALSE, content = TRUE,
  use_token = getOption("icesTAF.use_token") %||% FALSE)

Arguments

url

the url to get.

retry

should the get request be retried if first attempt fails? default TRUE.

quiet

should all messages be suppressed, default FALSE.

verbose

should verbose output form the http request be returned? default FALSE.

content

should content be returned, or the full http response? default TRUE, i.e. content is returned by default.

use_token

should an authentication token be sent with the request? default is the value of the option icesSAG.use_token.

Value

content or an http response.

Functions

  • taf_get_cached(): cached version of taf_get

See Also

taf_api builds a SAG web service url.

icesTAF-package gives an overview of the package.

Examples

## Not run: 
taf_get(taf_api("FLStocks"))

## End(Not run)

Post to a url

Description

Post to a url using an ICES authentication token

Usage

taf_post(url, body = list(), verbose = FALSE)

Arguments

url

the url to post.

body

a list of named arguments to be sent as the body of the post request.

verbose

should verbose output from the http request be returned? default FALSE.

Value

content of the http response.

See Also

taf_api builds a TAF web service url.

icesTAF-package gives an overview of the package.


TAF Skeleton

Description

Create initial directories and R scripts for a new TAF analysis using a stock assessment created on stockassessment.org.

Usage

taf.skeleton.sa.org(path = ".", stockname, force = FALSE)

Arguments

path

where to create initial directories and R scripts. The default is the current working directory.

stockname

The short-form name of a stock on stockassessment.org.

force

whether to overwrite existing scripts.

Value

Full path to analysis directory.

See Also

taf.skeleton creates an empty generic TAF skeleton.

icesTAF-package gives an overview of the package.

Examples

## Not run: 
taf.skeleton.sa.org(stockname = "WBCod_2021_cand01")

## End(Not run)

TAF Skeleton

Description

Create initial directories and R scripts for a new TAF analysis using a stock assessment created on stockassessment.org.

Usage

taf.template(template = "WKTNET:simple", force = FALSE, gitignore = TRUE,
  path = ".")

Arguments

template

which template to use. The default is "WKTNET:simple"

force

whether to overwrite existing scripts.

gitignore

whether to add a .gitignore file.

path

where to create initial directories and R scripts. The default is the current working directory.

Value

Full path to analysis directory.

See Also

taf.skeleton creates an empty generic TAF skeleton.

icesTAF-package gives an overview of the package.

Examples

## Not run: 
  taf.template(template = "WKTNET:simple")

## End(Not run)

Write an Artifact File

Description

Validate and write an artifact file.

Usage

write.artifacts(..., append = TRUE, check = TRUE)

Arguments

...

a list of artifact objects made using artifact.

append

logical, should the new artifacts be appended to the existing file?

check

logical, should the artifact be checked for validity?