facet_colcount: Get or set column count for a facet in column space

facet_colcountR Documentation

Get or set column count for a facet in column space

Description

Get or set column count for a facet in column space

Usage

facet_colcount(obj, path)

## S4 method for signature 'LayoutColTree'
facet_colcount(obj, path = NULL)

## S4 method for signature 'LayoutColLeaf'
facet_colcount(obj, path = NULL)

## S4 method for signature 'VTableTree'
facet_colcount(obj, path)

## S4 method for signature 'InstantiatedColumnInfo'
facet_colcount(obj, path)

facet_colcount(obj, path) <- value

## S4 replacement method for signature 'LayoutColTree'
facet_colcount(obj, path) <- value

## S4 replacement method for signature 'LayoutColLeaf'
facet_colcount(obj, path) <- value

## S4 replacement method for signature 'VTableTree'
facet_colcount(obj, path) <- value

## S4 replacement method for signature 'InstantiatedColumnInfo'
facet_colcount(obj, path) <- value

Arguments

obj

(ANY)
the object for the accessor to access or modify.

path

character. This path must end on a split value, e.g., the level of a categorical variable that was split on in column space, but it need not be the path to an individual column.

value

(ANY)
the new value.

Value

for facet_colcount the current count associated with that facet in column space, for ⁠facet_colcount<-⁠, obj modified with the new column count for the specified facet.

Note

Updating a lower-level (more specific) column count manually will not update the counts for its parent facets. This cannot be made automatic because the rtables framework does not require sibling facets to be mutually exclusive (e.g., total "arm", faceting into cumulative quantiles, etc) and thus the count of a parent facet will not always be simply the sum of the counts for all of its children.

See Also

col_counts()

Examples

lyt <- basic_table() %>%
  split_cols_by("ARM", show_colcounts = TRUE) %>%
  split_cols_by("SEX",
    split_fun = keep_split_levels(c("F", "M")),
    show_colcounts = TRUE
  ) %>%
  split_cols_by("STRATA1", show_colcounts = TRUE) %>%
  analyze("AGE")

tbl <- build_table(lyt, ex_adsl)

facet_colcount(tbl, c("ARM", "A: Drug X"))
facet_colcount(tbl, c("ARM", "A: Drug X", "SEX", "F"))
facet_colcount(tbl, c("ARM", "A: Drug X", "SEX", "F", "STRATA1", "A"))

## modify specific count after table creation
facet_colcount(tbl, c("ARM", "A: Drug X", "SEX", "F", "STRATA1", "A")) <- 25

## show black space for certain counts by assign NA

facet_colcount(tbl, c("ARM", "A: Drug X", "SEX", "F", "STRATA1", "C")) <- NA


rtables documentation built on June 27, 2024, 9:06 a.m.