findNA: Function to Identify NA Values by Row

Description Usage Arguments Value Examples

View source: R/utility_functions.R

Description

This function identifies rows in a matrix or data frame that contain any NA values.

Usage

1
findNA(x, any = T)

Arguments

x

a matrix or data frame.

any

logical; if TRUE check if any observation in the row is an NA value, else checks if all observations are NA.

Value

A logical vector with values of TRUE for rows with any NA values (or rows where all values are NA if any is FALSE).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x = matrix( rnorm(9), 3, 3 )
x[2,3] = NA
findNA( x )
x = data.frame( A = c( 1, 2, NA ), B = 0 )
findNA( x )

#' x = matrix( rnorm(9), 3, 3 )
x[2,] = NA
x[3,1] = NA
findNA( x, any = F )

rettopnivek/utilityf documentation built on March 1, 2021, 7:05 p.m.