plus-.DD: Method '+' for the class DD

Description Usage Arguments Value Examples

Description

+ sums two objects of class DD. This method overloads the operator + and returns a new object of class DD.

Usage

1
2
## S3 method for class 'DD'
e1 + e2

Arguments

e1

Object of class DD.

e2

Object of class DD.

Value

Object of class DD resulting from integrating both DD objects in a single DD 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
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
library(data.table)
VarList1 <- list(ID = data.table(IDQual = c('ID', rep('', 4)),
                                             NonIDQual = c(rep('', 5)),
                                             IDDD = c('', 'Name', 'Surname', 'PostalAddr', 
                                                      'PhoneNo'),
                                             ID = c('', rep('.', 4)),
                                             UnitName = c('numidest', 'nombre', 'apellidos', 
                                                'direccion', 'telefono'),
                                             InFiles = rep('FI', 5)),
                 MicroData = data.table(IDQual = c('ID', rep('', 2)),
                                                    NonIDQual = c('', 'Market', ''),
                                                    IDDD = c(rep('', 2), 'Turnover'),
                                                    ID = c(rep('', 2), '.'),
                                                    Market = c(rep('', 2), '1'),
                                                    UnitName = c('numidest', '', 'cn05'),
                                                    InFiles = rep('FF, FD, FG', 3)))
VNC1 <- BuildVNC(VarList1)

ID1dt <- data.table(Variable = c('ID', 'Name', 'Surname', 'PostalAddr', 'PhoneNo'),
                                Sort = c('IDQual', rep('IDDD', 4)),
                                Class = rep('character', 5),
                                Length = c('11', '25', '25', '50', '9'),
                                Qual1 = c('', rep('ID', 4)),
                                ValueRegExp = c('[0-9]{9}PP', '.+', '.+', '.+', 
                                                '(6|9)[0-9]{8}'))
Micro1dt <- data.table(Variable = c('ID', 'Market', 'Turnover'),
                                   Sort = c('IDQual', 'NonIDQual', 'IDDD'),
                                   Class = c(rep('character', 2), 'numeric'),
                                   Length = c('11', '2', '12'),
                                   Qual1 = c('', '', 'ID'),
                                   ValueRegExp = c('[0-9]{9}PP', '(0|1| )', '[0-9]{1,12}'))
Agg1dt <- 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}| )'))

DD1 <- DD(VNC = VNC1, ID = ID1dt, MicroData = Micro1dt, Aggregates = Agg1dt)

VarList2 <- list(ID = data.table(IDQual = c('ID', rep('', 4)),
                                             NonIDQual = c(rep('', 5)),
                                             IDDD = c('', 'Name', 'Surname', 'PostalAddr', 
                                                      'PhoneNo'),
                                             ID = c('', rep('.', 4)),
                                             UnitName = c('numidest', 'nombre', 'apellidos', 
                                                   'direccion', 'telefono'),
                                             InFiles = rep('FI', 5)),     
                 MicroData = data.table(IDQual = c('ID', rep('', 2)),
                                                   NonIDQual = c('', 'Market', ''),
                                                   IDDD = c(rep('', 2), 'NewOrders'),
                                                   ID = c(rep('', 2), '.'),
                                                   Market = c(rep('', 2), '1.'),
                                                   UnitName = c('numidest', '', 'cp09'),
                                                   InFiles = rep('FF, FD, FG', 3)))
VNC2 <- BuildVNC(VarList2)

ID2dt <- data.table(Variable = c('ID', 'Name', 'Surname', 'PostalAddr', 'PhoneNo'),
                                Sort = c('IDQual', rep('IDDD', 4)),
                                Class = rep('character', 5),
                                Length = c('11', '25', '25', '50', '9'),
                                Qual1 = c('', rep('ID', 4)),
                                ValueRegExp = c('[0-9]{9}PP', '.+', '.+', '.+', '(6|9)[0-9]{8}'))
Micro2dt <- data.table(Variable = c('ID', 'Market', 'NewOrders'),
                                   Sort = c('IDQual', 'NonIDQual', 'IDDD'),
                                   Class = c(rep('character', 2), 'numeric'),
                                   Length = c('11', '2', '7'),
                                   Qual1 = c(rep('', 2), 'ID'),
                                   ValueRegExp = c('[0-9]{9}PP', '(0|1| )', 
                                                   '([0-9]{1, 10}| )'))
Agg2dt <- data.table(Variable = c('Province', 'NACE09', 'NewOrders'),
                                 Sort = c(rep('IDQual', 2), 'IDDD'),
                                 Class = c(rep('character', 2), 'numeric'),
                                 Length = c('25', '4', '7'),
                                 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}| )'))

DD2 <- DD(VNC = VNC2, ID = ID2dt, MicroData = Micro2dt, Aggregates = Agg2dt)

DD1 + DD2

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