get_set-methods {simPop} | R Documentation |
Extract and modify variables from population or sample data stored in an
object of class simPopObj-class
.
Description
Using samp
samp<-
it is possible to extract or
rather modify variables of the sample data within slot data
in slot
sample
of the simPopObj-class
-object. Using
pop
pop<-
it is possible to extract or rather
modify variables of the synthetic population within in slot data
in
slot sample
of the simPopObj-class
-object.
Arguments
obj |
An object of class |
var |
variable name or index for the variable in slot 'samp' of object
with the slot name to be accessed. If |
value |
Content replacing whatever the variable in slot |
Value
Returns an object of class simPopObj-class
with the
appropriate replacement.
Author(s)
Bernhard Meindl
See Also
simPopObj-class
,pop
,
pop<-
, samp<-
, manageSimPopObj
Examples
data(eusilcS)
inp <- specifyInput(data=eusilcS, hhid="db030", hhsize="hsize", strata="db040",
weight="db090")
simPopObj <- simStructure(data=inp, method="direct", basicHHvars=c("age", "rb090"))
## get/set variables in sample-object of simPopObj
head(samp(simPopObj, var="age"))
samp(simPopObj, var="newVar") <- 1
head(samp(simPopObj, var="newVar"))
## deleting is also possible
samp(simPopObj, var="newvar") <- NULL
head(samp(simPopObj, var="newvar"))
## extract multiple variables
head(samp(simPopObj, var=c("db030","db040")))
## get/set variables in pop-object of simPopObj
head(pop(simPopObj, var="age"))
pop(simPopObj, var="newVar") <- 1
head(pop(simPopObj, var="newVar"))
## deleting is also possible
pop(simPopObj, var="newvar") <- NULL
head(pop(simPopObj, var="newvar"))
## extract multiple variables
head(pop(simPopObj, var=c("db030","db040")))
[Package simPop version 2.1.3 Index]