Creating TAF datasets - ices-taf/doc GitHub Wiki
See also: Bib entries, Example data records.
This page was based on using the icesTAF
package version 4.2.0
dated
2023-03-21
.
The first step is asking the ICES secratariat to create a repository for your stock. In this example we will work with North Sea cod: 2019_cod.27.47d20_assessment in 2019 - the repository name for the assessment will be 2019_cod.27.47d20_assessment. When a new repository is created on GitHub you should clone the repository to your own computer. From here we will assume you have cloned the repository.
The first step in creating a TAF analysis is to set out the basic folder
and file structure of the project. This is done using the function
taf.skeleton
,
which creates the following structure in your working directory
2019_cod.27.47d20_assessment
¦--boot
¦ °--initial
¦ °--data
¦--data.R
¦--model.R
¦--output.R
°--report.R
The next step is to set up the data requirements for your assessment. There are three ways to get data into an assessment: (1) upload files directly, (2) get a file from the web, and (3) use R code to access a web service. We will cover 1 and 2 here. See Example data records for more information.
To upload a file called catch.csv
- the contents might be something
like:
year,catches
2015,2109
2016,3455
2017,3466
2018,2050
Simply copy the file in to the boot/initial/data
folder. The directory
structure will now look like this:
2019_cod.27.47d20_assessment
¦--boot
¦ °--initial
¦ °--data
¦ °--catch.csv
¦--data.R
¦--model.R
¦--output.R
°--report.R
So far we have uploaded data into the intial data folder, but to make it
available to the assessment it needs to be in the boot/data
folder,
and the only way to do this is to create a file reference and then run
the function
taf.boot
. To
reference the data we create a file called DATA.bib
using the helper
function
draft.data
, and
add a few fields:
draft.data(
originator = "WGNSSK",
year = 2019,
title = "Catch data for cod.27.47d20",
period = "2015-2018"
)
## @Misc{catch.csv,
## originator = {WGNSSK},
## year = {2019},
## title = {Catch data for cod.27.47d20},
## period = {2015-2018},
## access = {Public},
## source = {file},
## }
Then we write this to the DATA.bib
file by specifying file = TRUE
:
draft.data(
originator = "WGNSSK",
year = 2019,
title = "Catch data for cod.27.47d20",
period = "2015-2018",
file = TRUE
)
Finally we run taf.boot()
to get the data into the boot/data
folder,
leaving the directory tree looking like this:
2019_cod.27.47d20_assessment
¦--boot
¦ ¦--data
¦ ¦ °--catch.csv
¦ ¦--DATA.bib
¦ °--initial
¦ °--data
¦ °--catch.csv
¦--data.R
¦--model.R
¦--output.R
°--report.R