as.spec: Create and Manipulate spec Objects

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

A spec is a keyed data.frame giving an abstract specification of a data table. It has columns column, label, type, guide, required, and derivation. These are descriptive or prescriptive for the specified table. The character method for as.spec expects a scalar file name. as.vector returns the documented column names. read.spec and write.spec use unquoted, tab-delimited cells, with '', ‘.’, and ‘NA’ representing missing values (na strings). The summary method does not worry about sort order. Generally one should not sort a spec, since record order is informative.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
	## S3 method for class 'character'
as.spec(x, ...)
	## S3 method for class 'data.frame'
as.spec(x, ...)
	## S3 method for class 'spec'
as.vector(x, mode = "any", ...)
	## S3 method for class 'spec'
summary(object, ...)
	read.spec(x, clean = TRUE,  ...)
	write.spec(x, file, ...)
	clean.spec(file,...)

Arguments

x

object of dispatch

object

object of dispatch

mode

passed to as.vector

clean

whether to strip leading and trailing quote characters and spaces

file

character

...

ignored or passed

Details

column gives the name and order of columns.

label is a descriptive substitute for column.

type is one of character,numeric, integer, or datetime, where datetime indicates something in the timepoint class.

guide is interpretive material: typically units for numeric columns, or encoded levels for factor-like columns. datetime columns expect a corresponding format string, as for as.mDateTime. Numeric guides are formally composed of an optional descriptor called guidetext followed by an optional range specifier in the form [0,30] or (0,30], etc.

required is an enforceable presence specifier, typically 0 or 1. It can be any R expression that can be coerced to logical and evaluated in the environment defined by the specified data frame.

derivation is (non-tab) free text intended as a high-level description of how the column depends on other columns or data sources.

Value

object of class spec keyed data.frame for read.spec and as.spec

Note

Since spec is stored as tab-delimited, it is rarely necessary to quote the contents of cells (though some external tools do this anyway). As of 5.56, matched leading/trailing double quotes and spaces are stripped by default for read.spec (after stripping outer white space). To clean up the stored file, use clean.spec.

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

1
example(`%matches%`)

metrumrg documentation built on May 2, 2019, 5:55 p.m.