miSubscript(x, k) miSubscript(x, k) <- value
miList
or
miVariable
, or a list containing one of these).
x
.
If
x
is an
miList
object, then
miSubscript(x,2)
is equivalent to
x[[2]]
.
If
x
is an
miVariable
object, the missing values in
x@Data
(indicated by
x@whichNA
) are replaced by the
k
th set of imputations (
x@Imputations[[k]]
), and the modified
version of
x@Data
is returned
(which is now a complete data object).
If
x
is an object containing
miList
or
miVariable
components
or slots,
the above rules are applied to those components to obtain
complete data objects to replace the components, and the resulting
list is returned.
If
x
contains imputations but is not of class
miList
,
it is first converted to an equivalent
miList
object
(equivalent in that the result of
miSubscript(x,j)
is unchanged).
After conversion, the
k
th component of
x
is replaced with
value
.
For
miSubscript(x,k) <- something
to work,
x
must exist
and be an
mi
object.
# an miList object (same as using [[]]) miSubscript(crimeImpExample, 2) # an miVariable object miSubscript(cholesterolImpExample, 2) # ordinary object -- returns the object miSubscript(1:5, 2) # list containing any miObject miSubscript(list(1, crimeImpExample), 2) miSubscript(list(1, cholesterolImpExample), 2) # Assignment. Result is always an miList x <- crimeImpExample miSubscript(x, 2) <- 0 x x <- cholesterolImpExample miSubscript(x, 2) <- 0 # result is an miList x x <- 1:5 # miSubscript(x, 2) <- 0 # Should fail, x is not an mi object