getVNC: Return slot 'VNC' from an object

Description Usage Arguments Value Examples

Description

getVNC extracts slot VarNameCorresp from an object of class DD or class StQ.

This method returns an object of class VarNameCorresp from an object of class DD or StQ specified as input argument.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
getVNC(object)

## S4 method for signature 'DD'
getVNC(object)

## S4 method for signature 'StQ'
getVNC(object)

## S4 method for signature 'rawStQ'
getVNC(object)

Arguments

object

Object of class DD or StQ.

Value

Object of class VarNameCorresp of the input object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
library(data.table)
VarList <- list(ID = data.table(IDQual = c('NumIdEst', rep('', 4)),
                                NonIDQual = c('','','','',''),
                                IDDD = c('', 'Name', 'Surname', 'PostalAddr', 'PhoneNo'),
                                NumIdEst = c('', rep('.', 4)),
                                UnitName = c('numidest', 'nombre', 'apellidos', 'direccion', 'telefono'),
                                InFiles = rep('FI', 5)),
MicroData = data.table(IDQual = c('NumIdEst', rep('', 2)),
                       NonIDQual = c('', 'Market', ''),
                       IDDD = c(rep('', 2), 'NewOrders'),
                       NumIdEst = c(rep('', 2), '.'),
                       Market = c(rep('', 2), '1'),
                       UnitName = c('numidest', '', 'cp09'),
                       InFiles = rep('FF, FD, FG', 3)),
ParaData = data.table(IDQual = c('NumIdEst', rep('', 2)),
                      NonIDQual = c('', 'Action', ''),
                      IDDD = c(rep('', 2), 'Date'),
                      NumIdEst = c(rep('', 2), '.'),
                      Action = c(rep('', 2), 'Imputation'),
                      UnitName = c('numidest', '', 'FechaImput'),
                      InFiles = rep('FP', 3)))

VNC <- BuildVNC(VarList)

IDdt <- data.table(Variable = c('NumIdEst', 'Name', 'Surname', 'PostalAddr', 'PhoneNo'),
                   Sort = c('IDQual', rep('IDDD', 4)),
                   Class = rep('character', 5),
                   Length = c('11', '15', '15', '20','9'),
                   Qual1 = c('', rep('NumIdEst', 4)),
                   ValueRegExp = c('[0-9]{9}PP', '.+', '.+', '.+', '(6|9)[0-9]{8}'))
Microdt <- data.table(Variable = c('NumIdEst', 'Market', 'NewOrders'),
                      Sort = c('IDQual', 'NonIDQual', 'IDDD'),
                      Class = c(rep('character', 2), 'numeric'),
                      Length = c('11', '2', '7'),
                      Qual1 = c(rep('', 2), 'NumIdEst'),
                      ValueRegExp = c('[0-9]{9}PP', '.+', '([0-9]{1, 10}| )'))
Paradt <- data.table(Variable = c('NumIdEst', 'Action', 'Date'),
                     Sort = c('IDQual', 'NonIDQual', 'IDDD'),
                     Class = rep('character', 3),
                     Length = c('11', '10', '10'),
                     Qual1 = c(rep('', 2), 'NumIdEst'),
                     Qual2 = c(rep('', 2), 'Action'),
                     ValueRegExp = c('[0-9]{9}PP', 'Collection|Editing|Imputation',
                                     '(([0-9]{2}-(0[1-9]|1(0-2))-[0-9]{4})| )'))

DD <- DD(VNC = VNC, ID = IDdt, MicroData = Microdt, ParaData = Paradt)
getVNC(DD)

david-salgado/StQ documentation built on Aug. 12, 2021, 3:23 p.m.