View source: R/create_cross_table_body.R
create_sub_table | R Documentation |
This function creates a styled cross table from a given data.frame that
already has cross table format.
It uses the columns specified in sub_table_cols
to separate the
table body into several sub tables, where each sub table has the current
value in the column defined by sub_table_cols
as sub heading.
The columns specified in y_cols_left
, x_cols
and value_cols
define the cross table structure.
The data.frame given in data
has already s
If the table should not be a cross table, but a normal table then the
arguments x_cols
and value_cols
should be omitted.
The function is a recursive function that builds that subTables from inside out.
create_sub_table(
data,
sub_level,
sub_table_cols,
sub_heading_stylings = NULL,
body_styling = NULL,
y_cols_left,
y_cols_right
)
data |
A data.frame that should be used for the creation of the cross table. |
sub_level |
This is the recursive counter that gives the deepness of the recursive function execution. It points to the current sub heading level. So sub_level == 1 means that we look at the sub headings given by the different values in the data.frame column that has the name given in |
sub_table_cols |
(optional) A vector of column names that should be used in order to separate the data.frame into several sub tables, that will be concatenated vertically. Each sub table will have a sub heading row above the sub table body. The sub heading text is just the corresponding value in the column defined by |
sub_heading_stylings |
(optional) A list of styling functions. A styling function is a function that takes a StyledTable object as its only argument and returns a styled function. The first styling function is applied to the level-1 sub heading (the sub heading defined by the first entry in |
body_styling |
(optional) A styling function that is applied to the generated styled body of each sub table. A styling function is a function that takes a StyledTable object as its only argument and returns a styled function. In order to format the value columns of the resulting cross table use the argument |
y_cols_left |
A vector of column names that are unchanged by the cross table compuation. If the table should not be a cross table, but a normal table this argument can be omitted. |
y_cols_right |
A vector of column names that are unchanged by the cross table compuation. This columns are of the same kind as the columns defined by the argument |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.