create_data: Create package data with one call. Taken from hake package.

View source: R/create-data.R

create_dataR Documentation

Create package data with one call. Taken from hake package.

Description

Usually you have to create a variable first, and then call [usethis::use_data()] with the variable name as an argument and the package data will be created. This function just unifies that into one step, and allows automated naming with 'paste0()', unlike 'usethis::use_data()'. Change name from original hake::create_data_hake(), as will work for any data object. See 'data-raw/groundfish/hake.R' for example use.

Usage

create_data(var, val)

Arguments

var

The variable name

val

The value for variable 'var'

Value

Nothing, creates package data. See 'usethis::use_data()'.

Author(s)

Chris Grandin (help file added to by Andrew Edwards)

Examples

## Not run: 
In data-raw/groundfish/hake.R see these lines (which allow `assess_yr` to
  part of the data object, which `use_data()` does not):
 create_data(paste0("hake_recruitment_", assess_yr),
             get(paste0("hake_recruitment_", assess_yr)))

## End(Not run)

pbs-assess/PACea documentation built on April 17, 2025, 11:36 p.m.