removeNA: remove rows with NA values in selcted columns of a data frame

View source: R/removeNA.R

removeNAR Documentation

remove rows with NA values in selcted columns of a data frame

Description

this function will remove all NA entries from selected columns of a data frame

Usage

removeNA(df, cols)

Arguments

df

a data frame

cols

a vector of column names or column numbers

Value

A data frame

Author(s)

Tim Appelhans

Examples

df <- data.frame(a = 1:10, b = letters[1:10], c = rnorm(10, 2, 1))
df$a[sample(nrow(df), 3)] <- NA
df$b[sample(nrow(df), 2)] <- NA
df$c[sample(nrow(df), 1)] <- NA

df

removeNA(df, 1)
removeNA(df, 2)
removeNA(df, 3)
removeNA(df, c(1, 2))
removeNA(df, c(1, 2, 3))


environmentalinformatics-marburg/Rsenal documentation built on July 28, 2023, 6:09 a.m.