epi_stats_na_perc: Get counts and percentage of NAs

View source: R/epi_stats_na_perc.R

epi_stats_na_percR Documentation

Get counts and percentage of NAs

Description

epi_stats_na_perc() gets the total counts and percentage for missing values across rows or columns

Usage

epi_stats_na_perc(df = NULL, margin = 2)

Arguments

df

A dataframe with missing values

margin

2 for columns, 1 for rows. Default is columns

Value

A dataframe object with counts and percentage of NAs for each column or row.

Author(s)

Antonio J Berlanga-Taylor <\url{https://github.com/AntonioJBT/episcout}>

See Also

complete.cases

Examples


## Not run: 
library(mice)
dim(nhanes)
epi_head_and_tail(nhanes, cols = 4)
# Get summary of counts and percentages for missing values across columns:
na_cols <- epi_stats_na_perc(nhanes, margin = 2)
na_cols
# Get summary of counts and percentages for missing values across rows:
na_rows <- epi_stats_na_perc(nhanes, margin = 1)
epi_head_and_tail(na_rows, cols = 2)
summary(na_rows)
length(which(na_rows$na_counts == 0))
# which should be equal to:
length(which(complete.cases(nhanes)))

## End(Not run)


AntonioJBT/episcout documentation built on Dec. 1, 2024, 4:07 a.m.