add_missing_subjects_row: Add a missing subject row into a count summary.

View source: R/count_bindings.R

add_missing_subjects_rowR Documentation

Add a missing subject row into a count summary.

Description

This function calculates the number of subjects missing from a particular group of results. The calculation is done by examining the total number of subjects potentially available from the Header N values within the result column, and finding the difference with the total number of subjects present in the result group. Note that for accurate results, the subject variable needs to be defined using the 'set_distinct_by()' function. As with other methods, this function instructs how distinct results should be identified.

Usage

add_missing_subjects_row(e, fmt = NULL, sort_value = NULL)

Arguments

e

A 'count_layer' object

fmt

An f_str object used to format the total row. If none is provided, display is based on the layer formatting.

sort_value

The value that will appear in the ordering column for total rows. This must be a numeric value.

Examples


tplyr_table(mtcars, gear) %>%
  add_layer(
    group_count(cyl) %>%
      add_missing_subjects_row(f_str("xxxx", n))
   ) %>%
   build()

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