specification: Create a Data Specification Corresponding to a Particular...

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

Description

as.spec works with objects that already look like metadata. In contrast, specification draws up draft metadata, given a candidate. The data.frame method makes the generic call on each of its members before proceeding, thus giving programmers a chance to provide preparatory methods.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
	## Default S3 method:
specification(x, ...)
	## S3 method for class 'comment'
specification(x, ...)
	## S3 method for class 'data.frame'
specification(x, tol = 10, sep = '/', digits = 20, ...)
	## S3 method for class 'spec'
respecify(x, data, file = NULL, ...)
	## S3 method for class 'character'
respecify(x, data=sub('spec$','csv',x), file=x, ...)

Arguments

x

object of dispatch

tol

consider an integer to be factor-like if it has this or fewer unique values.

sep

use this separator to encode factor-like objects.

digits

significant digits to retain for numeric range estimates

data

data.frame corresponding to x

file

filename for output

...

passed to other functions

Details

specification pre-processes each column, and then proceeds with generic documentation (see as.spec). It tries to guess among the standard types: character, numeric, integer, datetime, providing range and level information as appropriate. By default, labels are the same as the column names, unless the columns have a label attribute. Labels for the levels of factor-like objects (true factors, and other vectors with few unique values) are by default the same as the values themselves. Units for numerics are not guessed. Typically one refines the resulting spec to more closely specify data characteristics. It should always be true that x %matches% specification(x).

If the underlying data changes, numeric ranges can be updated using respecify. For a filename (character), the default behavior is to update the file in storage and return the new spec invisibly. Set file to NULL to leave storage untouched and return the spec visibly. For class spec, NULL is already default for file, and data must be specified (cannot be guessed).

Value

object with class spec keyed data.frame

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

1
example(`%matches%`)

anniejw6/metrumrg documentation built on May 10, 2019, 11:50 a.m.