Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

See Also

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

cwhmisc

Miscellaneous Functions for Math, Plotting, Printing, Statistics, Strings, and Tools

v6.6
GPL (>= 2)
Authors
Christian W. Hoffmann
Initial release
2018-08-24, 10:40:10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.