These are a couple of functions that help with accessing the data in rtables
objects.
Currently these work for occurrence tables, which are defined
as having a count as the first element and a fraction as the second element in each cell.
Usage
h_row_counts(
table_row,
col_names = NULL,
col_indices = h_col_indices(table_row, col_names)
)
h_row_fractions(
table_row,
col_names = NULL,
col_indices = h_col_indices(table_row, col_names)
)
h_col_counts(
table,
col_names = NULL,
col_indices = h_col_indices(table, col_names)
)
is_leaf_table(table)
h_content_first_row(table)
Arguments
- table_row
(
TableRow
)
an analysis row in a occurrence table.- col_names
(
character
)
the names of the columns to extract from.- col_indices
(
integer
)
the indices of the columns to extract from. Ifcol_names
are provided, then these are inferred from the names oftable_row
. (Note that this currently only works well with a single column split.)- table
(
VTableNodeInfo
)
an occurrence table or row.
Functions
h_row_counts()
: helper function to extract counts from specified columns in aTableRow
.h_row_fractions()
: helper function to extract fractions from specified columns in aTableRow
.h_col_counts()
: Helper function to extract column counts from specified columns in a table.is_leaf_table()
: Helper function which says whether current table is a leaf in the tree.h_content_first_row()
: Helper function to get first row of content table of current table.