R/inspect_na.R

Defines functions inspect_na

Documented in inspect_na

#' Summarize missingness in data frame columns
#'
#' @description
#' `inspect_na()` summarizes the rate of missingness in each column of a data frame. For a grouped data frame, the rate of missingness is summarized separately for each group.
#'
#' @details
#' The tibble returned contains the columns:
#' - **col_name**, a character vector containing column names of df1.
#'
#' - **cnt**, an integer vector containing the number of missing values by column.
#'
#' - **pcnt**, the percentage of records in each columns that is missing.
#'
#'
#' @param df A data frame
#'
#' @return
#' A tibble summarizing the count and percentage of columnwise missingness for a data frame.
#'
#' @export
#'
#' @examples
#'
#' library(dplyr)
#'
#' # dataframe summary
#'
#' inspect_na(airquality)
#'
#' # grouped dataframe summary
#'
#' airquality %>%
#' group_by(Month) %>%
#'  inspect_na()
#'
inspect_na <- function(df) {
  if (missing(df)) {
    stop("argument 'df' is missing, with no default")
  } else {
    inspectdf::inspect_na(df)
  }
}

Try the bulkreadr package in your browser

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

bulkreadr documentation built on May 29, 2024, 1:35 a.m.