Description Usage Arguments Details Value Examples
UnitToIDDDNames
returns a data.table with the statistical
variable name (IDDD + Qualifiers) corresponding to the production unit variable name specified as
input argument.
1 2 3 4 5 6 7 | UnitToIDDDNames(UnitNames, Correspondence)
## S4 method for signature 'character,DD'
UnitToIDDDNames(UnitNames, Correspondence)
## S4 method for signature 'character,StQ'
UnitToIDDDNames(UnitNames, Correspondence)
|
UnitNames |
|
Correspondence |
Object with the IDDD variable name. |
IDDD and qualifiers compose together the so-called IDDDname of the variable by pasting the IDDD identifier and each consecutive qualifier with an underscore _.
Returns a character
vector with all the corresponding IDDD variable names. For
objects the classes DD and StQ it returns the IDDD in the slot
VarNameCorresp of the corresponding DD object.
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | # An example for VNC and DD objects:
library(data.table)
### We build the VNC object
VarList <- list(ID = data.table(IDQual = c('NumIdEst', rep('', 4)),
NonIDQual = c(rep('',5)),
IDDD = c('', 'Name', 'Surname', 'PostalAddr',
'PhoneNo'),
NumIdEst = c('', rep('.', 4)),
UnitName = c('numidest', 'nombre', 'apellidos',
'direccion', 'telefono'),
InFiles = rep('FF', 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), '2.'),
UnitName = c('numidest', '', 'cp09'),
InFiles = rep('FF', 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)),
Aggregates = data.table(
IDQual = c('Province', 'NACE09', '', ''),
NonIDQual = c(rep('', 2), 'Market', ''),
IDDD = c('', '', '', 'Turnover'),
Province = c('', '', '', '.'),
NACE09 = c('', '', '', '.'),
Market = c('', '', '', '3.'),
UnitName = c('provincia', 'actividad', '', 'cn01'),
InFiles = rep('FA', 4)))
VNC <- BuildVNC(VarList)
### We build the specification data.tables
IDdt <- data.table(
Variable = c('NumIdEst', 'Name', 'Surname', 'PostalAddr', 'PhoneNo'),
Sort = c('IDQual', rep('IDDD', 4)),
Class = rep('character', 5),
Length = c('11', '25', '25', '50', '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'),
Qual2 = c(rep('', 2), 'Market'),
ValueRegExp = c('[0-9]{9}PP', '(0|1| )', '([0-9]{1, 10}| )'))
Paradt <- data.table(
Variable = c('NumIdEst', 'Action', 'Date'),
Sort = c('IDQual', 'NonIDQual', 'IDDD'),
Class = rep('character', 3),
Length = c('11', '4', '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})| )'))
Aggdt <- data.table(
Variable = c('Province', 'NACE09', 'Turnover'),
Sort = c(rep('IDQual', 2), 'IDDD'),
Class = c(rep('character', 2), 'numeric'),
Length = c('25', '4', '12'),
Qual1 = c(rep('', 2), 'Province'),
Qual2 = c(rep('', 2), 'NACE09'),
ValueRegExp = c('[0-9]{4}', '([0-4][0-9])|(5[0-2])', '([0-9]{1, 15}| )'))
DD <- DD(VNC = VNC,
ID = IDdt,
MicroData = Microdt,
ParaData = Paradt,
Aggregates = Aggdt)
UnitToIDDDNames(DD, UnitNames = c('cn01', 'cp09'))
# An example for StQ objects:
data(ExampleStQ)
UnitToIDDDNames(ExampleStQ, UnitNames = c('cnae09','C11','C121','C122' , 'EXISTENCIAS', 'B1'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.