Package 'qcTAF'

Title: TAF Checks
Description: Tools to check TAF analyses.
Authors: Arni Magnusson [aut, cre], Colin Millar [aut]
Maintainer: Arni Magnusson <[email protected]>
License: GPL-3
Version: 1.0.0
Built: 2026-12-02 09:42:57 UTC
Source: https://github.com/ices-tools-prod/qcTAF

Help Index


TAF Checks

Description

Tools to check TAF analyses.

Details

Quality control:

qc run all quality checks
qc.boot.exists boot directory exists
qc.data.bib.exists ⁠DATA.bib⁠ exists
qc.data.bib.valid ⁠DATA.bib⁠ is valid
qc.data.bib.processed ⁠DATA.bib⁠ processed
qc.data.declared data files are declared
qc.software.bib.exists ⁠SOFTWARE.bib⁠ exists
qc.software.bib.valid ⁠SOFTWARE.bib⁠ is valid
qc.software.bib.processed ⁠SOFTWARE.bib⁠ processed
qc.software.declared software files are declared
qc.initial.data initial data files
qc.only.relative.paths scripts use only relative paths
qc.any.scripts.exist any scripts exist
qc.all.scripts.exist all scripts exist

Validation with required and optional checks:

qc.validate run checks in a validation profile
qc.checks list checks in a validation profile
qc.passed no required check failed
qc.summary summary list, e.g. for JSON
qc.markdown summary Markdown table

Author(s)

Arni Magnusson and Colin Millar.

See Also

Useful links:


Print Validation Results

Description

Print results from qc.validate.

Usage

## S3 method for class 'qcTAF'
print(x, ...)

Arguments

x

result from qc.validate.

...

ignored.

Value

x, invisibly.

See Also

qc.validate runs the checks.

qcTAF-package gives an overview of the package.


Quality Check

Description

Run all quality checks for a given analysis.

Usage

qc(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

Logical vector indicating the result from each test.

See Also

The checks are run in the following order:

dir.exists checks if directory exists.

qc.boot.exists checks if boot directory exists.

qc.data.bib.exists checks if ⁠DATA.bib⁠ exists.

qc.data.bib.valid checks if ⁠DATA.bib⁠ is valid.

qc.data.bib.processed checks if ⁠DATA.bib⁠ entries have been processed.

qc.data.declared checks if data files are declared.

qc.software.bib.exists checks if ⁠SOFTWARE.bib⁠ exists.

qc.software.bib.valid checks if ⁠SOFTWARE.bib⁠ is valid.

qc.software.bib.processed checks if ⁠SOFTWARE.bib⁠ entries have been processed.

qc.data.declared checks if software files are declared.

qc.initial.data checks if initial data files have the same contents as boot data files.

qc.any.scripts.exist checks if any scripts exist.

qc.all.scripts.exist checks if all scripts exist.

qc.only.relative.paths checks if scripts use only relative paths.

qc.validate runs checks in a validation profile, where some checks are optional.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc("rjm-347d")

## End(Not run)

All Scripts Exist

Description

Check if all TAF scripts (⁠data.R⁠, ⁠model.R⁠, ⁠output.R⁠, and ⁠report.R⁠) exist.

Usage

qc.all.scripts.exist(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.all.scripts.exist("rjm-347d")

## End(Not run)

Any Scripts Exist

Description

Check if any TAF scripts (⁠data.R⁠, ⁠model.R⁠, ⁠output.R⁠, and ⁠report.R⁠) exist.

Usage

qc.any.scripts.exist(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.any.scripts.exist("rjm-347d")

## End(Not run)

Boot Directory Exists

Description

Check if a boot directory exists.

Usage

qc.boot.exists(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.boot.exists("rjm-347d")

## End(Not run)

Quality Check Definitions

Description

List the quality checks that make up a validation profile, with the level of each check (required or optional).

Usage

qc.checks(profile = "pre-run")

Arguments

profile

validation profile: "pre-run" or "post-run".

Details

A required check that fails is a failure. An optional check that fails is a warning and does not make the validation fail.

A check with a requires entry is only run if the named check passed, otherwise it is skipped. This is used for ⁠SOFTWARE.bib⁠: the file is optional, but if it exists it must be valid and its software must be declared.

The "pre-run" profile checks an analysis before taf.boot has been run. It leaves out qc.data.bib.processed and qc.software.bib.processed, which can only pass after taf.boot.

The "post-run" profile checks an analysis after it has been run, and requires the ⁠DATA.bib⁠ and ⁠SOFTWARE.bib⁠ entries to have been processed.

In both profiles, qc.software.bib.exists and qc.all.scripts.exist are optional.

Value

Data frame with columns check (function name), level ("required" or "optional"), and requires (check that must pass for this check to run, or NA).

See Also

qc.validate runs the checks in a profile.

qcTAF-package gives an overview of the package.

Examples

qc.checks()
qc.checks("post-run")

DATA.bib Exists

Description

Check if a ⁠DATA.bib⁠ file exists.

Usage

qc.data.bib.exists(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.data.bib.exists("rjm-347d")

## End(Not run)

DATA.bib Processed

Description

Check if a ⁠DATA.bib⁠ entries appear to have been processed, i.e., found as files and directories inside the boot folder.

Usage

qc.data.bib.processed(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

Note

qc.data.bib.processed checks if all bib entries have made it into the boot data folder:

DATA.bib | boot/data
---------+----------
    A    |
    B   ==>
    C    |

qc.data.declared checks if all boot data files were declared as bib entries:

DATA.bib | boot/data
---------+----------
         |    A
        <==   B
         |    C

When used together, those two functions ensure that ⁠DATA.bib⁠ and ⁠boot/data⁠ contain precisely the same entries.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.data.bib.processed("rjm-347d")

## End(Not run)

DATA.bib Valid

Description

Check if a ⁠DATA.bib⁠ file is valid.

Usage

qc.data.bib.valid(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.data.bib.valid("rjm-347d")

## End(Not run)

Data Declared

Description

Check if all files in the boot data folder are declared in the ⁠DATA.bib⁠ file.

Usage

qc.data.declared(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

Note

qc.data.bib.processed checks if all bib entries have made it into the boot data folder:

DATA.bib | boot/data
---------+----------
    A    |
    B   ==>
    C    |

qc.data.declared checks if all boot data files were declared as bib entries:

DATA.bib | boot/data
---------+----------
         |    A
        <==   B
         |    C

When used together, those two functions ensure that ⁠DATA.bib⁠ and ⁠boot/data⁠ contain precisely the same entries.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.data.declared("rjm-347d")

## End(Not run)

Initial Data

Description

Check if initial data files have the same contents as boot data files.

Usage

qc.initial.data(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Details

Files are compared recursively, so files inside folder entries are compared by their path within the folder. Files that exist in only one of ⁠boot/initial/data⁠ and ⁠boot/data⁠ are not compared.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.initial.data("rjm-347d")

## End(Not run)

Validation Markdown Table

Description

Format validation results as a Markdown table, for example to write to a GitHub Actions step summary.

Usage

qc.markdown(x)

Arguments

x

result from qc.validate.

Value

Character vector of Markdown lines.

See Also

qc.validate runs the checks.

qc.summary summarizes the results as a list.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
x <- qc.validate("rjm-347d")
writeLines(qc.markdown(x), Sys.getenv("GITHUB_STEP_SUMMARY"))

## End(Not run)

Only Relative Paths

Description

Check if scripts (⁠*.R⁠, ⁠*.Rmd⁠, ⁠Rnw⁠, ⁠*.qmd⁠) use only relative paths.

Usage

qc.only.relative.paths(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Details

Scripts are checked in the main analysis folder and its subfolders, such as ⁠boot⁠, except folders containing data, software, or results: ⁠boot/initial⁠, ⁠boot/data⁠, ⁠boot/software⁠, ⁠boot/library⁠, ⁠data⁠, ⁠model⁠, ⁠method⁠, ⁠output⁠, ⁠report⁠, and ⁠renv⁠.

URLs such as ⁠https://⁠ and ⁠ftp://⁠ are ignored, but ⁠file://⁠ URLs are checked, since they can point to absolute paths. Lines starting with ⁠#⁠ or ⁠%⁠ are ignored, as are ⁠README⁠ files.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.only.relative.paths("rjm-347d")

## End(Not run)

Validation Passed

Description

Check if a validation passed, meaning that no required check failed.

Usage

qc.passed(x)

Arguments

x

result from qc.validate.

Value

TRUE if no required check failed, otherwise FALSE.

See Also

qc.validate runs the checks.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
x <- qc.validate("rjm-347d")
qc.passed(x)

## End(Not run)

SOFTWARE.bib Exists

Description

Check if a ⁠SOFTWARE.bib⁠ file exists.

Usage

qc.software.bib.exists(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.software.bib.exists("rjm-347d")

## End(Not run)

SOFTWARE.bib Processed

Description

Check if a ⁠SOFTWARE.bib⁠ entries appear to have been processed, i.e., found as files and directories inside the boot folder.

Usage

qc.software.bib.processed(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

Note

qc.software.bib.processed checks if all bib entries have made it into the boot software folder:

SOFTWARE.bib | boot/software
-------------+--------------
      A      |
      B     ==>
      C      |

qc.software.declared checks if all boot software files were declared as bib entries:

SOFTWARE.bib | boot/software
-------------+--------------
             |      A
            <==     B
             |      C

When used together, those two functions ensure that ⁠SOFTWARE.bib⁠ and ⁠boot/software⁠ contain precisely the same entries.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.software.bib.processed("rjm-347d")

## End(Not run)

SOFTWARE.bib Valid

Description

Check if a ⁠SOFTWARE.bib⁠ file is valid.

Usage

qc.software.bib.valid(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.software.bib.valid("rjm-347d")

## End(Not run)

Software Declared

Description

Check if all files in the boot software folder are declared in the ⁠SOFTWARE.bib⁠ file.

Usage

qc.software.declared(analysis = ".")

Arguments

analysis

directory containing a TAF analysis.

Value

TRUE if test succeeds, otherwise FALSE.

Note

qc.software.bib.processed checks if all bib entries have made it into the boot software folder:

SOFTWARE.bib | boot/software
-------------+--------------
      A      |
      B     ==>
      C      |

qc.software.declared checks if all boot software files were declared as bib entries:

SOFTWARE.bib | boot/software
-------------+--------------
             |      A
            <==     B
             |      C

When used together, those two functions ensure that ⁠SOFTWARE.bib⁠ and ⁠boot/software⁠ contain precisely the same entries.

See Also

qc runs all qc.* tests.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
qc.software.declared("rjm-347d")

## End(Not run)

Validation Summary

Description

Summarize validation results as a list, suitable for writing to JSON.

Usage

qc.summary(x)

Arguments

x

result from qc.validate.

Value

List with elements passed_checks, warning_checks, failed_checks, skipped_checks (character vectors of check names), and passed (logical, see qc.passed).

See Also

qc.validate runs the checks.

qc.markdown summarizes the results as a Markdown table.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
x <- qc.validate("rjm-347d")
jsonlite::write_json(qc.summary(x), "qc.json", auto_unbox=TRUE)

## End(Not run)

Validate Analysis

Description

Run the quality checks in a validation profile, treating failed optional checks as warnings rather than failures.

Usage

qc.validate(analysis = ".", profile = "pre-run", optional = NULL)

Arguments

analysis

directory containing a TAF analysis.

profile

validation profile: "pre-run" (before taf.boot) or "post-run" (after the analysis has been run).

optional

names of additional checks to treat as optional.

Details

Each check gets one of four statuses:

"pass" check passed
"warn" optional check failed
"fail" required check failed
"skip" not run, because a check it requires did not pass

See qc.checks for the checks in each profile.

Value

Object of class qcTAF, a data frame with columns check, level, status, and passed (NA if skipped).

See Also

qc.checks lists the checks in a profile.

qc.passed, qc.summary, and qc.markdown summarize the results.

qc runs all checks and returns a logical vector.

qcTAF-package gives an overview of the package.

Examples

## Not run: 
x <- qc.validate("rjm-347d")
x
qc.passed(x)

## End(Not run)