rm_na_rows: Function to remove rows in a data frame when indices are all...

View source: R/rm_na_rows.R

rm_na_rowsR Documentation

Function to remove rows in a data frame when indices are all NA.

Description

rm_na_rows is useful when multiple variables/columns want to be evaluated for NAs and if all variables are NA, remove the row. rm_na_rows avoids the use of many !is.na(variable) filters for wide data frames.

Usage

rm_na_rows(df, index = NA)

Arguments

df

Data frame to be filtered.

index

Column index of df to be evaluated for NA testing. index usually takes multiple values and handles negative indices.

Author(s)

Stuart K. Grange

Examples

## Not run: 

Remove rows which contain only NAs in all but the first two columns
data_clean <- rm_na_rows(data, -1:-2)


## End(Not run)


skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.