Skip to contents

format_spec

format_spec

Public fields

name

format name

urn

urn

title

title

type

tpe

column_specs

column specifications

Methods


Method new()

Initializes a format specification from a JSON list object

Usage

format_spec$new(json = NULL)

Arguments

json

json


Method setName()

Set name

Usage

format_spec$setName(name)

Arguments

name

name


Method setURN()

Set URN

Usage

format_spec$setURN(urn)

Arguments

urn

urn


Method setTitle()

Set title

Usage

format_spec$setTitle(title)

Arguments

title

title


Method setType()

Set type

Usage

format_spec$setType(type)

Arguments

type

type


Method addColumnSpec()

Adds a column specification

Usage

format_spec$addColumnSpec(column_spec)

Arguments

column_spec

an object of class column_spec


Method getColumnSpecByName()

Get column specification by name

Usage

format_spec$getColumnSpecByName(name)

Arguments

name

name

Returns

an object of class column_spec, or NULL if no column specification is found


Method getColumnSpecByURN()

Get column specification by URN

Usage

format_spec$getColumnSpecByURN(urn)

Arguments

urn

urn

Returns

an object of class column_spec, or NULL if no column specification is found


Method getColumnSpecByAlias()

Get column specification by alias

Usage

format_spec$getColumnSpecByAlias(alias)

Arguments

alias

alias

Returns

an object of class column_spec, or NULL if no column specification is found


Method getColumnSpec()

Get column specification

Usage

format_spec$getColumnSpec(column)

Arguments

column

column name or alias

Returns

an object of class column_spec, or NULL if no column specification is found


Method validateStructure()

Applies data structure validation

Usage

format_spec$validateStructure(data)

Arguments

data

object of class data.frame or tibble

Returns

an object of class data.frame if any data structure validation issue is found (ERROR or WARNING), or NULL if valid


Method validateSeries()

Applies data series validation

Usage

format_spec$validateSeries(data)

Arguments

data

object of class data.frame or tibble

Returns

an object of class data.frame if any data series validation issue is found (ERROR or WARNING), or NULL if valid


Method validateContent()

Applies data content validation

Usage

format_spec$validateContent(
  data,
  mode = c("column", "pair"),
  parallel = FALSE,
  ...
)

Arguments

data

object of class data.frame or tibble

mode

validation mode, either "column" (default) or "pair"

parallel

whether the validation should be run as parallel (default FALSE)

...

any other arg

Returns

an object of class data.frame


Method validate()

Applies data validation

Usage

format_spec$validate(data, mode = c("column", "pair"), parallel = FALSE, ...)

Arguments

data

object of class data.frame or tibble

mode

validation mode, either "column" (default) or "pair"

parallel

whether the validation should be run as parallel (default FALSE)

...

any other arg

Returns

an object of class data.frame


Method display_as_handsontable()

Display data and validation report as Handsontable

Usage

format_spec$display_as_handsontable(data, report, ...)

Arguments

data

data

report

report

...

any other arg

Returns

an object of class rhandsontable


Method validate_and_display_as_handsontable()

Applies data validation

Usage

format_spec$validate_and_display_as_handsontable(
  data,
  parallel = FALSE,
  read_only = TRUE,
  use_css_classes = FALSE,
  ...
)

Arguments

data

object of class data.frame or tibble

parallel

whether the validation should be run as parallel (default FALSE)

read_only

read only

use_css_classes

use css classes

...

any other arg

Returns

an object of class rhandsontable


Method standardizeStructure()

Standardize structure

Usage

format_spec$standardizeStructure(data, exclude_unused = TRUE)

Arguments

data

data

exclude_unused

exclude unsed columns

Returns

the standardized data structure


Method standardizeContent()

Standardize content

Usage

format_spec$standardizeContent(data)

Arguments

data

data

Returns

the standardized data


Method createTemplate()

Creates template based on the format specification, including a template structure and eventual reference data files (codelists)

Usage

format_spec$createTemplate(use_aliases = FALSE, dir)

Arguments

use_aliases

use aliases?

dir

directory where to save the template

Returns

the path of the output template (as ZIP file)


Method clone()

The objects of this class are cloneable with this method.

Usage

format_spec$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.