View source: R/subset.mitml.list.R
subset.mitml.list | R Documentation |
Creates data subsets for a list of multiply imputed data sets.
## S3 method for class 'mitml.list'
subset(x, subset, select, ...)
x |
A list of imputed data sets with class |
subset |
An R expression by which to subset each data set. |
select |
An R expression by which to select columns. |
... |
Not used. |
This function can be used to create subsets and select variables for a list of multiply imputed data sets according to the R expressions given in the subset
and select
arguments.
The function is based on the subset
function for regular data sets and works in a similar manner.
Note that subsetting is performed individually for each data set.
For this reason, the cases included may differ across data sets if the variables used for subsetting contain different values.
A list of imputed data sets with class mitml.list
.
Simon Grund
data(studentratings)
fml <- ReadDis + SES ~ ReadAchiev + (1|ID)
imp <- panImpute(studentratings, formula = fml, n.burn = 1000, n.iter = 100, m = 5)
implist <- mitmlComplete(imp)
# * Example 1: subset by SES, select variables by name
subset(implist, SES < 25, select = c(ID, FedState, Sex, SES, ReadAchiev, ReadDis))
# * Example 2: subset by FedState, select variables by column number
subset(implist, FedState == "SH", select = -c(6:7, 9:10))
## Not run:
# * Example 3: subset by ID and Sex
subset(implist, ID
# * Example 4: select variables by name range
subset(implist, select = ID:Sex)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.