Skip to contents

Extracts incomplete cases from a data set. The companion function for selecting the complete cases is cc.

Usage

ic(x)

Arguments

x

An R object. Methods are available for classes mids, data.frame and matrix. Also, x could be a vector.

Value

A vector, matrix or data.frame containing the data of the complete cases.

See also

Author

Stef van Buuren, 2017.

Examples


ic(nhanes) # get the 12 rows with incomplete cases
#>    age  bmi hyp chl
#> 1    1   NA  NA  NA
#> 3    1   NA   1 187
#> 4    3   NA  NA  NA
#> 6    3   NA  NA 184
#> 10   2   NA  NA  NA
#> 11   1   NA  NA  NA
#> 12   2   NA  NA  NA
#> 15   1 29.6   1  NA
#> 16   1   NA  NA  NA
#> 20   3 25.5   2  NA
#> 21   1   NA  NA  NA
#> 24   3 24.9   1  NA
ic(nhanes[1:10, ]) # incomplete cases within the first ten rows
#>    age bmi hyp chl
#> 1    1  NA  NA  NA
#> 3    1  NA   1 187
#> 4    3  NA  NA  NA
#> 6    3  NA  NA 184
#> 10   2  NA  NA  NA
ic(nhanes[, c("bmi", "hyp")]) # restrict extraction to variables bmi and hyp
#>    bmi hyp
#> 1   NA  NA
#> 3   NA   1
#> 4   NA  NA
#> 6   NA  NA
#> 10  NA  NA
#> 11  NA  NA
#> 12  NA  NA
#> 16  NA  NA
#> 21  NA  NA