draft.data.script: Draft or create a boot data script

View source: R/draft.data.script.R

draft.data.scriptR Documentation

Draft or create a boot data script

Description

Create an ‘R’ file to fetch data including adding metadata via roxygen2 fields to the top of the file.

Usage

draft.data.script(name, title, description, format, originator, year, period,
  access, content)

Arguments

name

the name of the dataset and the file name that will be created.

title

description of the data, including survey names or the like.

description

a more involved description if required.

format

the format of the data produced, e.g. "csv"

originator

who prepared the data, e.g. a working group acronym.

year

year of the analysis when the data were used. The default is the current year.

period

a numeric vector of the form c(1990, 2000), indicating the first and last year that the data cover. Alternatively, a single number if the data cover only one year.

access

data access code: "OSPAR", "Public", or "Restricted".

content

the r code that fetches and saves the data

Examples

## Not run: 

# Create boot folder
mkdir("boot")

# Create boot script, boot/mydata.R
draft.data.script(name="mydata", title="Title", description="Description",
                  format="txt", originator="Me", year="2022",
                  period=c(2000,2020), access="Public",
                  content='write(pi, file="pi.txt")')

# Create metadata, boot/DATA.bib
taf.roxygenise(files="mydata.R")

# Run boot script, creating boot/data/mydata/pi.txt
taf.boot()

## End(Not run)


icesTAF documentation built on March 31, 2023, 5:20 p.m.