extract information from sdcMicroObj-class-objects depending on argument type

get.sdcMicroObj(object, type)

Arguments

object

a sdcMicroObj-class-object

type

a character vector of length 1 defining what to calculate|return|modify. Allowed types are are all slotNames of obj.

Value

a slot of a sdcMicroObj-class-object depending on argument type

Examples

sdc <- createSdcObj(testdata2,
  keyVars=c('urbrur','roof','walls','water','electcon','relat','sex'),
  numVars=c('expend','income','savings'), w='sampling_weight')
sl <- slotNames(sdc)
res <- sapply(sl, function(x) get.sdcMicroObj(sdc, type=x))
str(res)
#> List of 24
#>  $ origData         :'data.frame':	93 obs. of  19 variables:
#>   ..$ urbrur         : int [1:93] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ roof           : int [1:93] 2 2 2 2 2 4 4 4 4 4 ...
#>   ..$ walls          : int [1:93] 3 3 3 3 3 2 2 2 2 2 ...
#>   ..$ water          : int [1:93] 1 3 3 4 4 1 1 3 3 4 ...
#>   ..$ electcon       : int [1:93] 4 4 4 1 4 1 1 1 1 1 ...
#>   ..$ relat          : int [1:93] 1 3 1 3 2 3 2 3 2 3 ...
#>   ..$ sex            : int [1:93] 1 1 2 1 2 1 2 1 2 1 ...
#>   ..$ age            : int [1:93] 69 35 80 14 28 25 49 2 36 15 ...
#>   ..$ hhcivil        : int [1:93] 1 1 4 1 2 1 2 1 2 1 ...
#>   ..$ expend         : int [1:93] 30772412 77536815 15103477 99118978 55576313 46468920 20098853 4778454 58244413 89946151 ...
#>   ..$ income         : num [1:93] 72500000 10100000 56700000 12300000 26300000 88600000 60600000 26300000 46900000 94400000 ...
#>   ..$ savings        : num [1:93] 1230366 1856943 4807111 7195081 4934387 ...
#>   ..$ ori_hid        : int [1:93] 893 621 621 667 658 625 632 222 201 676 ...
#>   ..$ sampling_weight: int [1:93] 100 100 100 100 100 100 100 100 100 100 ...
#>   ..$ represent      : int [1:93] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ category_count : int [1:93] 1 1 1 11 20 58 62 59 66 31 ...
#>   ..$ relat2         : int [1:93] 10 30 10 30 10 30 10 30 10 30 ...
#>   ..$ water2         : int [1:93] 10 10 10 20 20 10 10 10 10 20 ...
#>   ..$ water3         : int [1:93] 100 100 100 200 200 100 100 100 100 200 ...
#>  $ keyVars          : int [1:7] 1 2 3 4 5 6 7
#>  $ pramVars         : NULL
#>  $ numVars          : int [1:3] 10 11 12
#>  $ ghostVars        : NULL
#>  $ weightVar        : int 14
#>  $ hhId             : NULL
#>  $ strataVar        : NULL
#>  $ sensibleVar      : NULL
#>  $ manipKeyVars     :'data.frame':	93 obs. of  7 variables:
#>   ..$ urbrur  : int [1:93] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ roof    : int [1:93] 2 2 2 2 2 4 4 4 4 4 ...
#>   ..$ walls   : int [1:93] 3 3 3 3 3 2 2 2 2 2 ...
#>   ..$ water   : int [1:93] 1 3 3 4 4 1 1 3 3 4 ...
#>   ..$ electcon: int [1:93] 4 4 4 1 4 1 1 1 1 1 ...
#>   ..$ relat   : int [1:93] 1 3 1 3 2 3 2 3 2 3 ...
#>   ..$ sex     : int [1:93] 1 1 2 1 2 1 2 1 2 1 ...
#>  $ manipPramVars    : NULL
#>  $ manipNumVars     :'data.frame':	93 obs. of  3 variables:
#>   ..$ expend : int [1:93] 30772412 77536815 15103477 99118978 55576313 46468920 20098853 4778454 58244413 89946151 ...
#>   ..$ income : num [1:93] 72500000 10100000 56700000 12300000 26300000 88600000 60600000 26300000 46900000 94400000 ...
#>   ..$ savings: num [1:93] 1230366 1856943 4807111 7195081 4934387 ...
#>  $ manipGhostVars   : NULL
#>  $ manipStrataVar   : NULL
#>  $ originalRisk     :List of 2
#>   ..$ global    :List of 5
#>   .. ..$ risk     : num 0.0465
#>   .. ..$ risk_ER  : num 4.33
#>   .. ..$ risk_pct : num 4.65
#>   .. ..$ threshold: num 0
#>   .. ..$ max_risk : num 0.01
#>   ..$ individual: num [1:93, 1:3] 0.0465 0.0465 0.0465 0.0465 0.0465 ...
#>   .. ..- attr(*, "dimnames")=List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : chr [1:3] "risk" "fk" "Fk"
#>  $ risk             :List of 3
#>   ..$ global    :List of 5
#>   .. ..$ risk     : num 0.0465
#>   .. ..$ risk_ER  : num 4.33
#>   .. ..$ risk_pct : num 4.65
#>   .. ..$ threshold: num 0
#>   .. ..$ max_risk : num 0.01
#>   ..$ individual: num [1:93, 1:3] 0.0465 0.0465 0.0465 0.0465 0.0465 ...
#>   .. ..- attr(*, "dimnames")=List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : chr [1:3] "risk" "fk" "Fk"
#>   ..$ numeric   : num 1
#>  $ utility          :List of 3
#>   ..$ il1  : num 0
#>   ..$ il1s : num 0
#>   ..$ eigen: num 0
#>  $ pram             : NULL
#>  $ localSuppression : NULL
#>  $ options          :List of 4
#>   ..$ seed            : logi NA
#>   ..$ max_size        : num 1e+05
#>   ..$ randomizeRecords: logi FALSE
#>   ..$ alpha           : num 1
#>  $ additionalResults: NULL
#>  $ set              :List of 9
#>   ..$ : chr "origData"
#>   ..$ : chr "keyVars"
#>   ..$ : chr "manipKeyVars"
#>   ..$ : chr "numVars"
#>   ..$ : chr "manipNumVars"
#>   ..$ : chr "weightVar"
#>   ..$ : chr "options"
#>   ..$ : chr "risk"
#>   ..$ : chr "utility"
#>  $ prev             : NULL
#>  $ deletedVars      : NULL