RepoDDToDD: Produce an object of class DD from a DD file

Description Usage Arguments Value Examples

View source: R/RepoDDToDD.R

Description

This function is a constructor for the class DD using the contents of the input DD file name (an xml file).

RepoDDToDD reads xml files with the definition and properties of every variable (a DD file) and transforms this content into an object of class DD.

This function internally builds a data.table with columns Variable, Sort, Class, Qual1 to Qualq and ValueRegExp.

The column Variable contains the names of all variables, both questionnaire variables and metadata. This internal data.table is then used to initialize a DD object.

The column Sort takes values 'IDQual', 'NonIDQual' or 'IDDD', for statistical unit qualifiers, variable name qualifiers and variable names, respectively.

The column Class specifies the class of the variable and takes values numeric or character.

The column Length contains the highest length for each variable.

The columns Qual1 to Qualq contain the names of the qualifiers of every variable name (row).

The column ValueRegExp contains a regexp with the accepted values for each variable.

Usage

1
RepoDDToDD(FileName, VNC)

Arguments

FileName

Character vector of length 1 with the name of the file to read. The file will be read from the working directory (see getwd) unless the full path is specified.

VNC

Object of class VNC.

Value

Return an object of class DD.

Examples

1
2
3
4
5
6
7
8
# An example with data created previosly:
## Not run: 
ExcelName <- 'T:/E30163/E30163.NombresVariables_V1.xlsx'
VNC <- RepoXLSToVNC(ExcelName)
RepoDDFileName <- 'T:/E30163/E30163.DD_V1'
RepoDDToDD(RepoDDFileName, VNC)

## End(Not run)

david-salgado/RepoReadWrite documentation built on Oct. 3, 2021, 1:09 p.m.