as.definitions.modelname: Create Item Definitions from Model Name

Description Usage Arguments Value See Also Examples

Description

Creates item definitions from a model name. Scavenges definitions optionally from the control stream and optionally from the definitions file. Optionally writes the result to the definitions file. Always returns a data.frame with at least the column 'item' but possibly no rows.

Usage

1
2
3
4
5
6
7
## S3 method for class 'modelname'
as.definitions(x, verbose = FALSE,
  opt = getOption("project"), project = if (is.null(opt)) getwd() else opt,
  rundir = file.path(project, x), ctlfile = file.path(rundir, paste0(x,
  ".ctl")), metafile = file.path(rundir, paste0(x, ".def")),
  fields = c("symbol", "label", "unit"), read = length(metafile) == 1,
  write = FALSE, ...)

Arguments

x

a model name (numeric or character)

verbose

set FALSE to suppress messages

opt

alternative argument for setting project

project

parent directory of model directories

rundir

specific model directory

ctlfile

path to control stream (pass length-zero argument to ignore)

metafile

path to definitions file (pass length-zero argument to ignore)

fields

metadata fields to read from control stream if no metafile

read

whether to read the definitions file

write

whether to write the definitions file

...

passed to other functions

Value

object of class definitions, or path to metafile if write = TRUE.

See Also

as.xml_document.modelname

as.bootstrap.modelname

as.nmctl.modelname

write.csv

read.csv

Examples

1
2
3
library(magrittr)
options(project = system.file('project/model',package='partab'))
1001 %>% as.definitions

bergsmat/partab documentation built on May 12, 2019, 3:09 p.m.