R/na_viz.R

Defines functions na_viz

Documented in na_viz

#' Visualize NA frequency in data
#'
#' @description
#' `na_viz()` create a ggplot plot showing the percentage of NA in each column
#'
#' @param data a data frame
#'
#' @return a ggplot object
#'
#' @section Acknowledgment:
#' `na_viz()` is another name for the excellent `vis_miss()` of
#' [`{naniar}`](https://github.com/njtierney/naniar)
#'
#' @export
#'
#' @examples
#' \donttest{
#' if (interactive()) {
#' na_data <- data.frame(c1 = c(1, NA), c2 = c(NA, NA))
#' na_data %>% na_viz()
#' }
#' }
na_viz <- function(data) {
  check_require("naniar")
  data %>%
    naniar::vis_miss(x = .)
}

Try the misc package in your browser

Any scripts or data that you put into this service are public.

misc documentation built on April 8, 2026, 9:10 a.m.