clean.na: Clean a matrix or data frame of rows or columns of containing...

Description Usage Arguments Value Author(s) See Also Examples

Description

clean.na Eliminate rows or columns containing NA.

Usage

1
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

1
2
3
4
5
6
  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

Example output

Loading required package: lattice
Loading required package: grid
     [,1] [,2]
[1,]    1    2
[1] 2 5

cwhmisc documentation built on May 1, 2019, 7:55 p.m.