missingness: Calculate and Visualize Missingness

View source: R/missings.R

missingnessR Documentation

Calculate and Visualize Missingness

Description

This function lets the user calculate the percentage of NAs or missingness in a data.frame. It also plots the results if needed.

Usage

missingness(df, plot = FALSE, full = FALSE, subtitle = NA, summary = TRUE)

Arguments

df

Dataframe. Dataframe to study

plot

Boolean. Do you wish to plot results?

full

Boolean. Return all variables (or only with missings)?

subtitle

Character. Subtitle to show in plot

summary

Boolean. Show numerical summary text?

Value

data.frame with each variable, number of missing values and percentage. If plot=TRUE, a plot with the same information reflected.

See Also

Other Exploratory: corr_cross(), corr_var(), crosstab(), df_str(), distr(), freqs(), freqs_df(), freqs_list(), freqs_plot(), lasso_vars(), plot_cats(), plot_df(), plot_nums(), tree_var()

Other Missing Values: impute()

Examples

Sys.unsetenv("LARES_FONT") # Temporal

# Dummy data
df <- data.frame(
  A = c(1:5),
  B = c(NA, NA, 1, 1, 1),
  C = rep(NA, 5),
  D = c(NA, LETTERS[1:4])
)

# Missing values summary
missingness(df)

# Visual results

missingness(df, plot = TRUE)

# Show all variables (including those with no missing values)
missingness(df, plot = TRUE, full = TRUE)

lares documentation built on Sept. 13, 2024, 1:08 a.m.