Package 'framqaqc'

Title: What the Package Does (One Line, Title Case)
Description: QAQC tools for comparing FRAM databases.
Authors: Collin Edwards [aut, cre] (ORCID: <https://orcid.org/0000-0002-4937-5159>)
Maintainer: Collin Edwards <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2026-07-09 16:47:54 UTC
Source: https://github.com/FRAMverse/framqaqc

Help Index


Compare tables between two databases

Description

Compare tables between two databases

Usage

compare_table_across_dbs(fram_db_1, fram_db_2, table_name)

Arguments

fram_db_1

fram database connection to first database (used as reference for ratio calculations)

fram_db_2

fram database connection to second database

table_name

Name of table to compare

Value

tibble of comparisons, including run_id, as appropriate stock_id, age, fishery_id, time_step. ⁠$db1⁠ and ⁠$db2⁠ give the values in the database for column ⁠$metric⁠; ⁠$diff_exact⁠ has db1-db2, and ⁠$diff_ratio⁠ has db2/db1.

Examples

## Not run: 
library(framrsquared)
fram_a = connect_fram_db(
"C:/Repos/fram multirun testing/Formal testing/coho_preseason_notamm_a.mdb",
read_only = TRUE,
quiet = TRUE)
fram_c = connect_fram_db(
"C:/Repos/fram multirun testing/Formal testing/coho_preseason_notamm_c.mdb",
                        read_only = TRUE,
                       quiet = TRUE)
compare_table_across_dbs(fram_a, fram_c, "Mortality")
disconnect_fram_db(fram_a)
disconnect_fram_db(fram_b)

## End(Not run)

Plot the values of the two databases against each other

Description

Creates faceted plots based on the output of compare_table_across_dbs(), with the values from one database plotted against the corresponding values from the other. If two databases are exactly the same, all points should fall on the 1:1 line; dashed 1:1 line included as reference. To improve performance, avoids plotting duplicate and near-duplicate entries. "near-duplicate" is controlled by argument round_digits.

Usage

plot_comparisons_exact(tab, round_digits = 0)

Arguments

tab

tibble produced from compare_table_across_dbs().

round_digits

Digits to round to before identifying entries as "near-duplicate" entries. Defaults to 0 (e.g., round to the nearest fish). Appropriate to reduce when comparing tables in which values are much smaller.

Value

ggplot object


Plot the ratios of database comparisons

Description

Creates faceted plots based on the output of compare_table_across_dbs(), with the ratio of db2/db1 plotted against the values of db1. If two databases are exactly the same, all points should have a ratio of exactly 1; dashed horizontal line at 1 is included as reference. To improve performance, avoids plotting duplicate and near-duplicate entries. "near-duplicate" values of db1 is controlled by argument round_digits; ratio values within 0.001 are treated as near-duplicate.

Usage

plot_comparisons_ratio(tab, round_digits = 0)

Arguments

tab

tibble produced from compare_table_across_dbs().

round_digits

digits to round db1 to in order to avoid plotting near-duplicate points.

Value

ggplot object


Summarize exact differences from compare_table_across_dbs()

Description

Makes a quick summary of the outputs of compare_table_across_dbs(), giving min, max, 0.01 and 0.99 quantiles of the absolute differences of values by run id. A perfect match would have values that are all 0.

Usage

summarize_exact(tab)

Arguments

tab

tibble produced from compare_table_across_dbs().

Value

gt with summary information.


Summarize ratio differences from compare_table_across_dbs()

Description

Makes a quick summary of the outputs of compare_table_across_dbs(), giving min, max, 0.01 and 0.99 quantiles of the ratio of values from db2 / db1, by run id. Ignore entries with values <=1 to db1 to avoid divide-by-zero issues and inflation of small differences.

Usage

summarize_ratio(tab)

Arguments

tab

tibble produced from compare_table_across_dbs().

Value

gt with summary information.