ices-tools-prod / icesTAF

Functions to support the ICES Transparent Assessment Framework
GNU General Public License v3.0
5 stars 7 forks source link

Introduce roxygen style documentation of bootstrap data sets #20

Closed colinpmillar closed 3 years ago

colinpmillar commented 4 years ago

A fairly complete example is show in the gist here:

https://gist.github.com/colinpmillar/2d823f938d3e9fe642ea9d8c1d00ebf5

the idea is to replace draft.data() with taf.roxygenise() which generates the DATA.bib file automatically, this will allow the system to update feilds automatically, and utilise online sources for metadata. Since the DATA.bib file is generated automatically, then icesTAF is free to add feilds, and update feilds, which is better than the current setup which potentially leaves the DATA.bib incorrect (hand edited) and out of date (cannot be updated without direct edits).

the example above produces:

@Misc{ICES_StatRec_mapto_Ecoregions,
  originator = {DTU Aqua},
  year       = {2019},
  title      = {ICES Stat rec ESRI Shapefile},
  period     = {NA},
  access     = {Public},
  source     = {script},
}

from

#' ICES Stat rec ESRI Shapefile
#'
#' An ESRI shapefile of ICES statistical rectangles mapped to ecoregions
#'
#' @name ICES_StatRec_mapto_Ecoregions
#' @format ESRI shapefile
#'
#' @tafOriginator DTU Aqua
#' @tafYear 2019
#' @tafAccess Public
#' @tafSource script
#'
#' @references 
#' \url{https://gis.ices.dk/geonetwork/srv/metadata/81f68a99-9b91-4762-80d3-31c069731f44}

filename <- "ICES_StatRec_mapto_Ecoregions.zip"

# download and unzip
download(paste0("http://gis.ices.dk/shapefiles/", filename))
unzip(filename)

# delete zip file
unlink(filename)

by running the command: taf.roxygenise()

other benefits are that the documentation is kept with the script that created it. initial data can also be documented in this way to.

idea

draft.data() could be modified to produce the roxygen headers