set_denom_ignore: Set values the denominator calculation will ignore

View source: R/count_bindings.R

set_denom_ignoreR Documentation

Set values the denominator calculation will ignore

Description

'r lifecycle::badge("defunct")'

This is generally used for missing values. Values like "", NA, "NA" are common ways missing values are presented in a data frame. In certain cases, percentages do not use "missing" values in the denominator. This function notes different values as "missing" and excludes them from the denominators.

Usage

set_denom_ignore(e, ...)

Arguments

e

A count_layer object

...

Values to exclude from the percentage calculation. If you use 'set_missing_counts()' this should be the name of the parameters instead of the values, see the example below.

Value

The modified layer object

Examples

library(magrittr)
mtcars2 <- mtcars
mtcars2[mtcars$cyl == 6, "cyl"] <- NA
mtcars2[mtcars$cyl == 8, "cyl"] <- "Not Found"

tplyr_table(mtcars2, gear) %>%
  add_layer(
    group_count(cyl) %>%
      set_missing_count(f_str("xx ", n), Missing = c(NA, "Not Found"))
      # This function is currently deprecated. It was replaced with an
      # argument in set_missing_count
      # set_denom_ignore("Missing")
  ) %>%
  build()

Tplyr documentation built on May 29, 2024, 10:37 a.m.