Learn R Programming

rtables (version 0.6.1)

trim_rows: Trim rows from a populated table without regard for table structure

Description

Trim rows from a populated table without regard for table structure

Usage

trim_rows(tt, criteria = all_zero_or_na)

Value

The table with rows that have only NA or 0 cell values removed

Arguments

tt

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

criteria

function. Function which takes a TableRow object and returns TRUE if that row should be removed. Defaults to all_zero_or_na

Details

This function will be deprecated in the future in favor of the more elegant and versatile prune_table() function which can perform the same function as trim_rows() but is more powerful as it takes table structure into account.

See Also

prune_table()

Examples

Run this code
adsl <- ex_adsl
levels(adsl$SEX) <- c(levels(ex_adsl$SEX), "OTHER")

tbl_to_trim <- basic_table() %>%
    analyze("BMRKR1") %>%
    split_cols_by("ARM") %>% 
    split_rows_by("SEX") %>% 
    summarize_row_groups() %>%
    split_rows_by("STRATA1") %>%
    summarize_row_groups() %>%
    analyze("AGE") %>%
    build_table(adsl)

tbl_to_trim %>% trim_rows()

tbl_to_trim %>% trim_rows(all_zero)

Run the code above in your browser using DataLab