num_row_NAs

0th

Percentile

Counts number of NAs in each row

This function will return a vector, with the same length as the number of rows of the provided data frame, corresponding to the number of missing values in each row

Usage
num_row_NAs(data, allow.NaN = FALSE)
Arguments
data

A data frame

allow.NaN

Treat NaN like NA (by counting it). FALSE by default

Value

A vector of number of missing values in each row

See Also

is.na is.nan not_na

Aliases
  • num_row_NAs
Examples
# NOT RUN {
num_row_NAs(mtcars)


library(magrittr)            # for piping operator
library(dplyr)               # for "everything()" function

# using every column from mtcars, make sure there are at most
# 2 NAs in each row. If there are any more than two, error out
mtcars %>%
  assert_rows(num_row_NAs, within_bounds(0,2), everything())
  ## anything here will run

# }
Documentation reproduced from package assertr, version 2.7, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.