Skip to content

Repository files navigation

tufman2R

An R package for accessing Tufman2 reports via API requests. The package is developed by the SPC's FAME-Data Management Team. Tufman 2 users can use this package to authenticate, list available reports, and download report data. A YAML-based bundle workflow is available for recurring multi-report pulls.

Installation

# install.packages("remotes")
remotes::install_github("git@github.com:PacificCommunity/tufman2R", build_vignettes = TRUE)

Setup

Credentials are read from environment variables, never hardcoded. Run this once for setup instructions:

tufman2R::tuf_setup_help()

which walks you through adding TUF_USER, TUF_PASSWORD, and TUF_COUNTRY to your .Renviron file via usethis::edit_r_environ().

Quick example

library(tufman2R)

reports <- tuf_list_reports()

selected <- tuf_get_report_attributes(c(3605, 3083))

data <- tuf_get_report_data(
  selected,
  attrs = list(flag_code = "FJ", year = 2024),
  save_folder = "data/"
) # add `overwrite = TRUE` if you want to make sure you are overwriting any existing csv already saved locally from other runs.

See vignette("getting-started") for a full walkthrough, and vignette("report-bundles") for defining a recurring set of reports as a single YAML file.

About

An R client for the accessing Tufman2 reports developed by SPC's Oceanic Fisheries Programme.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages