naPercentage: Calculate and Print the Percentage of Missing Data Within a...

View source: R/naPercentage.R

naPercentageR Documentation

Calculate and Print the Percentage of Missing Data Within a Data Structure

Description

Calculates the percentage of NA values within each column or row of a data structure.

Usage

naPercentage(x, by.row = FALSE, row.range = 1:nrow(x), col.range = 1:ncol(x))

Arguments

x

A matrix-like R object with two dimensions to get the missing data percentage for.

by.row

A logical value indicating whether to calculate the missing data percentage by row.

row.range

A numeric vector containing the row numbers to be included in the missing percentage calculation.

col.range

A numeric vector containing the column numbers to be included in the missing percentage calculation.

Value

Returns a data frame with the columns sharing the same column or row names as the passed data and a single row containing the percentage of elements within a row or column with NA values.

Examples

# Default by column
na_pct <- naPercentage(data)

# By row, excluding first column
na_pct_byrow <- naPercentage(data_byrow, by.row = TRUE, col.range = 2:ncol(x))


Echinoidea/hooks-imputation documentation built on May 8, 2022, 4:39 p.m.