Skip to content

About

R and R Markdown scripts used by the IWC Secretariat Statistics and Modelling Department to produce recurring statistical reports, tables, appendices and circular communications

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

IWC Statistics Reporting

This repository contains R and R Markdown scripts used by the IWC Secretariat Statistics and Modelling Department to produce recurring statistical reports, tables, appendices and circular communications.

Many of these products are prepared every one or two years. The aim of the repository is to retain the code used to produce them, make recurring reporting more reproducible, and reduce the amount of manual processing required when reports are updated.

Repository structure

RMD_statistics_reporting/
├── catches and infractions/
├── circulars/
├── inputs/
├── O paper catches/
├── outputs/
└── README.md

catches and infractions/

Contains scripts used to prepare catch and infractions summaries and reports, including annual and multi-year catch summaries, infractions tables and appendices.

See catches and infractions/README.md.

circulars/

Contains R Markdown files and Word reference documents used to generate recurring IWC Circular Communications.

See circulars/README.md.

inputs/

Contains the mock, synthetic and supporting input files required to test and run the reporting workflows.

See inputs/README.md.

O paper catches/

Contains the R Markdown workflow used to prepare catch reports for Scientific Committee O papers.

See O paper catches/README.md.

outputs/

Contains reports and tables generated by the scripts.

See outputs/README.md.

Software

The workflows are written mainly in R and R Markdown.

Packages used across the repository include:

readxl
dplyr
tidyverse
plyr
reshape2
flextable
officer
magrittr
lubridate
stringr

Individual scripts may require only a subset of these packages.

File paths

The scripts generally use relative paths so that the repository can be moved or cloned without rewriting local file paths.

For example:

../inputs/NationsMembership.xlsx
../inputs/catches-postMoratorium-test.xlsx
../outputs/

The repository folder structure should therefore be retained.

User-specific absolute paths should be avoided.

Mock and synthetic data

The repository contains mock or synthetic datasets that reproduce the structure expected by the reporting scripts.

These allow the workflows to be:

  • tested without access to operational data;
  • checked after changes to the scripts;
  • used as examples of the expected input structure;
  • tested after changes to R or package versions.

Operational, confidential or personal data should not be committed to a public repository.

Running the workflows

Many reports contain parameters in the R Markdown YAML header, for example:

params:
  first_year: 2024
  last_year: 2025

Before generating a report:

  1. check the relevant folder README;
  2. ensure the required input files are available in inputs/;
  3. check the year or reporting-period parameters;
  4. knit the .Rmd file or run the relevant .R script;
  5. review the generated Word document;
  6. check any placeholders, dates, reference numbers, signatories and links before circulation.

Reproducibility

Where possible, data manipulation, table construction, captions and document generation should remain within the R/R Markdown workflow rather than being edited manually after the output has been created.

This repository is intended to provide a reproducible record of the workflows used to prepare recurring IWC statistical reporting products.

About

R and R Markdown scripts used by the IWC Secretariat Statistics and Modelling Department to produce recurring statistical reports, tables, appendices and circular communications

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages