Skip to contents

The complete case indicator is useful for extracting the subset of complete cases. The function cci(x) calls complete.cases(x). The companion function ici() selects the incomplete cases.

Usage

cci(x)

Arguments

x

An R object. Currently supported are methods for the following classes: mids.

Value

Logical vector indicating the complete cases.

See also

Author

Stef van Buuren, 2017.

Examples

cci(nhanes) # indicator for 13 complete cases
#>  [1] FALSE  TRUE FALSE FALSE  TRUE FALSE  TRUE  TRUE  TRUE FALSE FALSE FALSE
#> [13]  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE FALSE FALSE  TRUE  TRUE FALSE
#> [25]  TRUE
cci(mice(nhanes, maxit = 0))
#>  [1] FALSE  TRUE FALSE FALSE  TRUE FALSE  TRUE  TRUE  TRUE FALSE FALSE FALSE
#> [13]  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE FALSE FALSE  TRUE  TRUE FALSE
#> [25]  TRUE
f <- cci(nhanes[, c("bmi", "hyp")]) # complete data for bmi and hyp
nhanes[f, ] # obtain all data from those with complete bmi and hyp
#>    age  bmi hyp chl
#> 2    2 22.7   1 187
#> 5    1 20.4   1 113
#> 7    1 22.5   1 118
#> 8    1 30.1   1 187
#> 9    2 22.0   1 238
#> 13   3 21.7   1 206
#> 14   2 28.7   2 204
#> 15   1 29.6   1  NA
#> 17   3 27.2   2 284
#> 18   2 26.3   2 199
#> 19   1 35.3   1 218
#> 20   3 25.5   2  NA
#> 22   1 33.2   1 229
#> 23   1 27.5   1 131
#> 24   3 24.9   1  NA
#> 25   2 27.4   1 186