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], Alexandros Kokkalis [ctb], Iago Mosqueira [ctb], Ibrahim Umar [ctb], Hjalte Parner [ctb] |
Maintainer: | Colin Millar <[email protected]> |
License: | GPL-3 |
Version: | 4.2.0 |
Built: | 2024-10-25 02:44:07 UTC |
Source: | https://github.com/ices-tools-prod/icesTAF |
Functions to support the ICES Transparent Assessment Framework, to organize data, methods, and results used in ICES assessments.
Initial TAF steps:
draft.data.script |
create boot script |
taf.roxygenise |
create DATA.bib entry from tags |
Colin Millar and Arni Magnusson.
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.
Download an ‘R’ file from the ICES datasets repo to fetch data including adding metadata via roxygen2 fields to the top of the file.
add.data.script(name, install.deps = TRUE, commit = FALSE)
add.data.script(name, install.deps = TRUE, commit = FALSE)
name |
the name of the dataset. |
install.deps |
install packages used in the script if not already installed. |
commit |
should the boot script be added and committed to the analysis. |
## Not run: # Create boot folder mkdir(taf.boot.path()) # Create boot script, boot/mydata.R add.data.script(name = "vms") # Create metadata, boot/DATA.bib taf.roxygenise(files = "vms.R") # Run boot script, creating boot/data/vms/... taf.boot() ## End(Not run)
## Not run: # Create boot folder mkdir(taf.boot.path()) # Create boot script, boot/mydata.R add.data.script(name = "vms") # Create metadata, boot/DATA.bib taf.roxygenise(files = "vms.R") # Run boot script, creating boot/data/vms/... taf.boot() ## End(Not run)
Print the directory tree and file contents in a pretty way
dir.tree(path = ".")
dir.tree(path = ".")
path |
the directory for which the listing is to be shown |
## Not run: library(icesTAF) # Download a TAF analysis dir.tree() ## End(Not run)
## Not run: library(icesTAF) # Download a TAF analysis dir.tree() ## End(Not run)
Download the code for a TAF analysis from GitHub.
download.analysis(repo, dir = tempdir())
download.analysis(repo, dir = tempdir())
repo |
The full name of the GitHub repository, e.g. "ices-taf/2019_san.sa.6". |
dir |
the directory to place the TAF project |
## Not run: library(icesTAF) # Download a TAF analysis run_dir <- download.analysis("ices-taf/2019_san.sa.6", dir = ".") # run the analysis run.analysis(run_dir) ## End(Not run)
## Not run: library(icesTAF) # Download a TAF analysis run_dir <- download.analysis("ices-taf/2019_san.sa.6", dir = ".") # run the analysis run.analysis(run_dir) ## End(Not run)
Create an ‘R’ file to fetch data including adding metadata via roxygen2 fields to the top of the file.
draft.data.script(name, title, description, format, originator, year, period, access, content)
draft.data.script(name, title, description, format, originator, year, period, access, content)
name |
the name of the dataset and the file name that will be created. |
title |
description of the data, including survey names or the like. |
description |
a more involved description if required. |
format |
the format of the data produced, e.g. "csv" |
originator |
who prepared the data, e.g. a working group acronym. |
year |
year of the analysis when the data were used. The default is the current year. |
period |
a numeric vector of the form |
access |
data access code: |
content |
the r code that fetches and saves the data |
## Not run: # Create boot folder mkdir("boot") # Create boot script, boot/mydata.R draft.data.script(name="mydata", title="Title", description="Description", format="txt", originator="Me", year="2022", period=c(2000,2020), access="Public", content='write(pi, file="pi.txt")') # Create metadata, boot/DATA.bib taf.roxygenise(files="mydata.R") # Run boot script, creating boot/data/mydata/pi.txt taf.boot() ## End(Not run)
## Not run: # Create boot folder mkdir("boot") # Create boot script, boot/mydata.R draft.data.script(name="mydata", title="Title", description="Description", format="txt", originator="Me", year="2022", period=c(2000,2020), access="Public", content='write(pi, file="pi.txt")') # Create metadata, boot/DATA.bib taf.roxygenise(files="mydata.R") # Run boot script, creating boot/data/mydata/pi.txt taf.boot() ## End(Not run)
Search R scripts for packages that are required and install them.
install.deps(path = ".", ...)
install.deps(path = ".", ...)
path |
a directory or file containing R scripts. |
... |
arguments passed on to install.packages |
## Not run: library(icesTAF) # Download a TAF analysis download("https://github.com/ices-taf/2019_san.sa.6/archive/refs/heads/master.zip") unzip("master.zip") # move into analysis folder setwd("2019_san.sa.6-master") # list dependencies deps() # install dependencies install.deps() ## End(Not run)
## Not run: library(icesTAF) # Download a TAF analysis download("https://github.com/ices-taf/2019_san.sa.6/archive/refs/heads/master.zip") unzip("master.zip") # move into analysis folder setwd("2019_san.sa.6-master") # list dependencies deps() # install dependencies install.deps() ## End(Not run)
Run the code for a TAF analysis locally.
run.analysis(dir)
run.analysis(dir)
dir |
the directory where the TAF project is located |
## Not run: library(icesTAF) # Download a TAF analysis run_dir <- download.analysis("ices-taf/2019_san.sa.6", dir = ".") # run the analysis run.analysis(run_dir) ## End(Not run)
## Not run: library(icesTAF) # Download a TAF analysis run_dir <- download.analysis("ices-taf/2019_san.sa.6", dir = ".") # run the analysis run.analysis(run_dir) ## End(Not run)
Predefined colors that can be useful in TAF plots.
taf.green taf.orange taf.blue taf.dark taf.light
taf.green taf.orange taf.blue taf.dark taf.light
TAF-package
gives an overview of the package.
taf.green opar <- par(mfrow=c(3,1)) barplot(5:1, main="Five", col=c(taf.green, taf.orange, taf.blue, taf.dark, taf.light)) barplot(6:1, main="Six", col=c(taf.green, taf.orange, taf.blue, taf.dark, taf.light, "white")) barplot(7:1, main="Seven", col=c("black", taf.dark, taf.light, taf.green, taf.orange, taf.blue, "white")) par(opar)
taf.green opar <- par(mfrow=c(3,1)) barplot(5:1, main="Five", col=c(taf.green, taf.orange, taf.blue, taf.dark, taf.light)) barplot(6:1, main="Six", col=c(taf.green, taf.orange, taf.blue, taf.dark, taf.light, "white")) barplot(7:1, main="Seven", col=c("black", taf.dark, taf.light, taf.green, taf.orange, taf.blue, "white")) par(opar)
This function builds documentation for a TAF repository using roxygen syntax headers. It depends on the roxygen2 package adding some extra functionality to produce citation entries for data sources
taf.roxygenise(path = ".", files)
taf.roxygenise(path = ".", files)
path |
location of taf repository top level directory. Default is working directory. |
files |
a vector of file names to parse for documentation. |
## Not run: # Create boot folder mkdir("boot") # Create boot script, boot/mydata.R draft.data.script(name="mydata", title="Title", description="Description", format="txt", originator="Me", year="2022", period=c(2000,2020), access="Public", content='write(pi, file="pi.txt")') # Create metadata, boot/DATA.bib taf.roxygenise(files="mydata.R") # Run boot script, creating boot/data/mydata/pi.txt taf.boot() ## End(Not run)
## Not run: # Create boot folder mkdir("boot") # Create boot script, boot/mydata.R draft.data.script(name="mydata", title="Title", description="Description", format="txt", originator="Me", year="2022", period=c(2000,2020), access="Public", content='write(pi, file="pi.txt")') # Create metadata, boot/DATA.bib taf.roxygenise(files="mydata.R") # Run boot script, creating boot/data/mydata/pi.txt taf.boot() ## End(Not run)
Create initial directories and R scripts for a new TAF analysis using a stock assessment created on stockassessment.org.
taf.skeleton.sa.org(path = ".", stockname, force = FALSE)
taf.skeleton.sa.org(path = ".", stockname, force = FALSE)
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. |
Full path to analysis directory.
package.skeleton
creates an empty template for a new R package.
TAF-package
gives an overview of the package.
## Not run: taf.skeleton.sa.org(stockname = "WBCod_2021_cand01") ## End(Not run)
## Not run: taf.skeleton.sa.org(stockname = "WBCod_2021_cand01") ## End(Not run)