Learn R Programming

rtables (version 0.6.13)

subset_cols: Subset a table or row to particular columns

Description

Subset a table or row to particular columns

Usage

subset_cols(
  tt,
  j,
  newcinfo = NULL,
  keep_topleft = TRUE,
  keep_titles = TRUE,
  keep_footers = keep_titles,
  ...
)

# S4 method for TableTree,numeric subset_cols( tt, j, newcinfo = NULL, keep_topleft = TRUE, keep_titles = TRUE, keep_footers = keep_titles, ... )

# S4 method for ElementaryTable,numeric subset_cols( tt, j, newcinfo = NULL, keep_topleft = TRUE, keep_titles = TRUE, keep_footers = keep_titles, ... )

# S4 method for ANY,character subset_cols( tt, j, newcinfo = NULL, keep_topleft = TRUE, keep_titles = TRUE, keep_footers = keep_titles, ... )

# S4 method for TableRow,numeric subset_cols( tt, j, newcinfo = NULL, keep_topleft = TRUE, keep_titles = TRUE, keep_footers = keep_titles, ... )

# S4 method for LabelRow,numeric subset_cols( tt, j, newcinfo = NULL, keep_topleft = TRUE, keep_titles = TRUE, keep_footers = keep_titles, ... )

# S4 method for InstantiatedColumnInfo,numeric subset_cols( tt, j, newcinfo = NULL, keep_topleft = TRUE, keep_titles = TRUE, keep_footers = keep_titles, ... )

# S4 method for LayoutColTree,numeric subset_cols( tt, j, newcinfo = NULL, keep_topleft = TRUE, keep_titles = TRUE, keep_footers = keep_titles, ... )

Arguments

tt

(TableTree or related class)
a TableTree object representing a populated table.

j

(integer, logical or character)
The column(s) to subset tt down to. Character vectors are interpreted as a column path, not as names. Path can include "*" wildcards.

newcinfo

(NULL or InstantiatedColumnInfo)
The new column info, if precomputed. Generally should not be manually set by users.

keep_topleft

(flag)
if TRUE (the default), top_left material for the table will be carried over to the subset.

keep_titles

(flag)
if TRUE (the default), all title material for the table will be carried over to the subset.

keep_footers

(flag)
if TRUE, all footer material for the table will be carried over to the subset. It defaults to keep_titles.

...

Ignored.

Examples

Run this code
lyt <- basic_table(
  title = "Title",
  subtitles = c("Sub", "titles"),
  prov_footer = "prov footer",
  main_footer = "main footer"
) %>%
  split_cols_by("ARM") %>%
  split_cols_by("SEX") %>%
  analyze(c("AGE"))

tbl <- build_table(lyt, DM)

subset_cols(tbl, c(1, 3))
subset_cols(tbl, c("ARM", "*", "SEX", "F"))

Run the code above in your browser using DataLab