Count the number of NAs in an object

Share:

Description

Count the number of NAs in an object

Usage

1
2
3
4
5
6
7
na_count(x, ...)

## S3 method for class 'data.frame'
na_count(x, columns = c(), ...)

## Default S3 method:
na_count(x, ...)

Arguments

x

An object, either a vector or a data.frame

...

Extra arguments to na_count

columns

Vector of column names

Methods (by class)

  • data.frame: If columns are specified, returns the maximum of the count of NAs for those columns. Otherwise, it returns the number of rows that have a NA in any column.

  • default: Calls na.omit on x, and returns the length of the result. This is only meaningful for one-dimensional objects (vectors).

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.