Version: 4.3.0
Title: Functions to Support the ICES Transparent Assessment Framework
Depends: TAF (≥ 4.3.0)
Imports: icesVocab (≥ 1.3.1), icesDatsu (≥ 1.2.1), icesSAG (≥ 1.6.2), jsonlite, rlang, icesConnect, httr
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.
License: GPL-3
URL: https://taf.ices.dk, https://github.com/ices-tools-prod/icesTAF
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-09-02 10:12:50 UTC; arnim
Author: Colin Millar [aut, cre]
Maintainer: Colin Millar <colin.millar@ices.dk>
Repository: CRAN
Date/Publication: 2025-09-02 10:50:02 UTC

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


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

## Not run: 
# 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)


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)

Various TAF Helper Functions

Description

These functions are called by user-level functions. The functionality is documented in the user-level functions.

See Also

icesTAF-package gives an overview of the package.


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?


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)


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

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.


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?