clean.na {cwhmisc}R Documentation

Clean a matrix or data frame of rows or columns of containing NA.

Description

clean.na Eliminate rows or columns containing NA.

Usage

clean.na(x,margin,drop=FALSE)

Arguments

x

A matrix.

margin

= 1 for rows, = 2 for columns

drop

= FALSE (default) if result should be a matrix even if it contains only one row or column.

Value

The matrix without the offending rows or columns.

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

See Also

drop.

Examples

  x <- matrix(c(1,NA,2,5),2,2)
  clean.na(x,1)
#     [,1] [,2]
#[1,]    1    2
  clean.na(x,2,TRUE)
# [1] 2 5

[Package cwhmisc version 6.6 Index]