gfcmSTAR-package: Tools to Work with GFCM Stock Assessment Results (STAR)

Description Details Script Note Author(s) References See Also

Description

Tools that support the Stock Assessment Results (STAR) framework of the General Fisheries Commission for the Mediterranean.

Details

Import:

import.many.templates import many templates
import.many.csv import many CSV files
read.star.csv read a pair of CSV files
read.template read STAR template
read.template.v10 read STAR template version 1.0
read.template.v21 read STAR template version 2.1
read.properties read SharePoint properties
set.classes convert data types
template.version detect STAR template version

Export:

export.many.csv export many STAR objects to CSV files
write.star.csv write STAR object to CSV files

Manipulate strings:

append.id modify existing Assessment_ID
combo combine reference year, species, and GSA
gsa.names convert GSA codes to full GSA names

Lookup tables:

lookup.gsa geographical subareas (GSA)
lookup.species species

Quality control:

diff.stars show differences between STAR objects
identical.stars check if STAR objects are identical
peek examine a metadata field
qc run all quality checks
qc.exists file exists
qc.xlsx file extension is ‘xlsx
qc.star file is a STAR template
qc.vpa VPA_Model is Yes or No
qc.ts.names time series column names are intact
qc.ts.numbers time series are numbers and not strings
report report files successfully imported
write.report write a report object to a text file

Script

A fully annotated script to import and export a large collection of STARs is found here:

import.R

It demonstrates administrative procedures to quality check and handle STAR templates that may contain errors. This script can also be found on the local hard drive:

1
system.file("scripts/import.R", package="gfcmSTAR")

Note

STAR objects store Metadata as class c("simple.list", "list") in order to have it display in a compact and readable format in the console. It is easy to convert to a normal list or data frame:

1
2
3
star$Metadata                 # simple.list (default)
unclass(star$Metadata)        # list
as.data.frame(star$Metadata)  # data.frame

The main drawback of the simple.list format is that date-time objects are shown as integers in the console. This is only a minor display issue - the date-time objects are stored as POSIXct objects and are easy to access:

1
2
star$Metadata$Time_Modified
star$Metadata$Time_Imported

Author(s)

Arni Magnusson.

References

https://github.com/gfcm/star

https://github.com/gfcm/gfcmSTAR

See Also

The gfcmSTAR package uses XLConnect to read STAR templates, as it supports Excel table objects.


gfcm/gfcmSTAR documentation built on Feb. 5, 2022, 2:14 p.m.