Learn R Programming

cwhmisc (version 6.0)

clean.na: 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.

See Also

drop.

Examples

Run this code
  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

Run the code above in your browser using DataLab