set_missing_count: Set the display for missing strings

View source: R/count_bindings.R

set_missing_countR Documentation

Set the display for missing strings

Description

Controls how missing counts are handled and displayed in the layer

Usage

set_missing_count(e, fmt = NULL, sort_value = NULL, denom_ignore = FALSE, ...)

Arguments

e

A count_layer object

fmt

An f_str object to change the display of the missing counts

sort_value

A numeric value that will be used in the ordering column. This should be numeric. If it is not supplied the ordering column will be the maximum value of what appears in the table plus one.

denom_ignore

A boolean. Specifies Whether or not to include the missing counts specified within the ... parameter within denominators. If set to TRUE, the values specified within ... will be ignored.

...

Parameters used to note which values to describe as missing. Generally NA and "Missing" would be used here. Parameters can be named character vectors where the names become the row label.

Value

The modified layer

Examples

library(magrittr)
library(dplyr)
  mtcars2 <- mtcars %>%
mutate_all(as.character)
mtcars2[mtcars$cyl == 6, "cyl"] <- NA

tplyr_table(mtcars2, gear) %>%
  add_layer(
    group_count(cyl) %>%
      set_missing_count(f_str("xx ", n), Missing = NA)
  ) %>%
  build()

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