Package: rtables 0.6.10
rtables: Reporting Tables
Reporting tables often have structure that goes beyond simple rectangular data. The 'rtables' package provides a framework for declaring complex multi-level tabulations and then applying them to data. This framework models both tabulation and the resulting tables as hierarchical, tree-like objects which support sibling sub-tables, arbitrary splitting or grouping of data in row and column dimensions, cells containing multiple values, and the concept of contextual summary computations. A convenient pipe-able interface is provided for declaring table layouts and the corresponding computations, and then applying them to data.
Authors:
rtables_0.6.10.tar.gz
rtables_0.6.10.zip(r-4.5)rtables_0.6.10.zip(r-4.4)rtables_0.6.10.zip(r-4.3)
rtables_0.6.10.tgz(r-4.4-any)rtables_0.6.10.tgz(r-4.3-any)
rtables_0.6.10.tar.gz(r-4.5-noble)rtables_0.6.10.tar.gz(r-4.4-noble)
rtables_0.6.10.tgz(r-4.4-emscripten)rtables_0.6.10.tgz(r-4.3-emscripten)
rtables.pdf |rtables.html✨
rtables/json (API)
NEWS
# Install 'rtables' in R: |
install.packages('rtables', repos = c('https://insightsengineering.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/insightsengineering/rtables/issues
Last updated 2 months agofrom:c6ee2daea5 (on v0.6.10). Checks:OK: 7. Indexed: yes.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Oct 23 2024 |
R-4.5-win | OK | Oct 23 2024 |
R-4.5-linux | OK | Oct 23 2024 |
R-4.4-win | OK | Oct 23 2024 |
R-4.4-mac | OK | Oct 23 2024 |
R-4.3-win | OK | Oct 23 2024 |
R-4.3-mac | OK | Oct 23 2024 |
Exports:.add_row_summary.tablerowadd_colcountsadd_combo_facetadd_combo_levelsadd_existing_tableadd_overall_coladd_overall_facetadd_overall_leveladd_to_split_resultall_zeroall_zero_or_naanalyzeanalyze_colvarsAnalyzeColVarSplitAnalyzeMultiVarsAnalyzeVarSplitappend_topleftas_htmlas_result_dfassert_valid_tablebasic_tablebuild_tablecbind_rtablescell_footnotescell_footnotes<-cell_valuesCellValueclayoutclayout<-clear_indent_modscol_countscol_counts<-col_exprscol_fnotes_herecol_fnotes_here<-col_footnotescol_footnotes<-col_infocol_info<-col_pathscol_paths_summarycol_totalcol_total<-colcount_formatcolcount_format<-colcount_na_strcolcount_na_str<-colcount_visiblecolcount_visible<-collect_leavescoltreecoltree_structurecompare_rtablescont_n_allcolscont_n_onecolcontent_all_zeros_nascontent_tablecontent_table<-ContentRowcounts_wpctsDataRowdf_to_ttdo_base_splitdrop_and_remove_levelsdrop_facet_levelsdrop_split_levelsElementaryTableEmptyColInfoEmptyElTableexport_as_docxexport_as_pdfexport_as_tsvexport_as_txtfacet_colcountfacet_colcount<-facet_colcounts_visible<-find_degen_structfnotes_at_path<-format_rcellget_formatted_cellsheadheader_section_divheader_section_div<-horizontal_sephorizontal_sep<-import_from_tsvin_rowsindentindent_modindent_mod<-indent_stringinsert_row_at_pathinsert_rrowInstantiatedColumnInfois_rtablekeep_split_levelslabel_at_pathlabel_at_path<-LabelRowlist_wrap_dflist_wrap_xlow_obs_prunermain_footermain_footer<-main_titlemain_title<-make_afunmake_col_dfmake_row_dfmake_split_funmake_split_resultmanual_colsManualSplitmargins_landscapemargins_potraitmatrix_formMultiVarSplitncolnlinesno_colinfonon_ref_rcellnrowobj_avarobj_formatobj_format<-obj_labelobj_label<-obj_na_strobj_na_str<-obj_nameobj_name<-pag_tt_indicespaginate_tablepath_enriched_dfprov_footerprov_footer<-prune_empty_levelprune_tableprune_zeros_onlyqtableqtable_layoutrawvaluesrbindrbind2rbindl_rtablesrcellref_indexref_index<-ref_msgref_symbolref_symbol<-remove_split_levelsreorder_split_levelsresult_df_specsrheaderrm_all_colcountsrow_cellsrow_footnotesrow_footnotes<-row_pathsrow_paths_summaryrow_valuesrow_values<-row.namesrrowrrowlrtablertablelsanitize_table_structsection_divsection_div<-section_properties_defaultselect_all_levelssimple_analysissort_at_pathspl_context_to_disp_pathspl_variablesplit_cols_bysplit_cols_by_cutfunsplit_cols_by_cutssplit_cols_by_multivarsplit_cols_by_quartilessplit_rows_bysplit_rows_by_cutfunsplit_rows_by_cutssplit_rows_by_multivarsplit_rows_by_quartilesstrsubtitlessubtitles<-summarize_row_groupstable_insettable_inset<-table_shelltable_shell_strtable_structureTableTreetailtheme_docx_defaulttheme_html_defaulttop_lefttop_left<-top_level_section_divtop_level_section_div<-toStringtree_childrentree_children<-trim_levels_in_facetstrim_levels_in_grouptrim_levels_to_maptrim_rowstt_at_pathtt_at_path<-tt_to_flextableupdate_ref_indexingvalidate_table_structvalue_atvalue_formatsvalue_namesVarDynCutSplitVarLevelSplitVarLevWBaselineSplitvars_in_layoutViewerword_mm_to_pt
Dependencies:backportsbase64enccheckmateclidigestfastmapformattersgluehtmltoolslifecyclemagrittrrlangstringi
{rtables} Advanced Usage
Rendered fromadvanced_usage.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2023-12-07
Started: 2023-01-11
Column Counts and Formats
Rendered fromcol_counts.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2024-06-16
Comparing Against Baselines or Control
Rendered frombaseline.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2023-10-20
Started: 2020-07-03
Comparison with dplyr Tabulation
Rendered fromtabulation_dplyr.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2020-07-30
Constructing rtables Manually
Rendered frommanual_table_construction.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2023-02-24
Started: 2020-07-03
Controlling Splitting Behavior
Rendered fromsplit_functions.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2023-02-27
Customizing Appearance
Rendered fromcustom_appearance.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2022-11-14
Example Clinical Trials Tables
Rendered fromclinical_trials.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2020-07-03
Example Complex Analysis Function: Modelling Cox Regression
Rendered fromexample_analysis_coxreg.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2023-07-11
Exploratory Analysis
Rendered fromexploratory_analysis.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2023-08-28
Format Precedence and NA Handling
Rendered fromformat_precedence.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2023-07-28
Started: 2023-02-23
Introduction to {rtables}
Rendered fromrtables.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2017-11-27
Introspecting Tables
Rendered fromintrospecting_tables.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2023-12-06
Pruning and Sorting Tables
Rendered fromsorting_pruning.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2020-08-31
Subsetting and Manipulating Table Contents
Rendered fromsubsetting_tables.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2020-07-30
Tabulation Concepts
Rendered fromtabulation_concepts.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2020-07-03
Titles, Footers, and Referential Footnotes
Rendered fromtitle_footer.Rmd
usingknitr::rmarkdown
on Oct 23 2024.Last update: 2024-09-06
Started: 2022-10-08
Readme and manuals
Help Manual
Help page | Topics |
---|---|
Add the column population counts to the header | add_colcounts |
Add a combination facet in post-processing | add_combo_facet add_overall_facet |
Add an already calculated table to the layout | add_existing_table |
Add overall column | add_overall_col |
Add overall or combination levels to split groups | add_combo_levels add_overall_level select_all_levels |
Additional parameters within analysis and content functions ('afun'/'cfun') | additional_fun_params |
Trimming and pruning criteria | all_zero all_zero_or_na content_all_zeros_nas low_obs_pruner prune_empty_level prune_zeros_only |
Generate rows analyzing variables across columns | analyze |
Generate rows analyzing different variables across columns | analyze_colvars |
Define a subset tabulation/analysis | AnalyzeColVarSplit AnalyzeMultiVars AnalyzeVarSplit |
Append a description to the 'top-left' materials for the layout | append_topleft |
Convert an 'rtable' object to a 'shiny.tag' HTML object | as_html |
Convert to a vector | as.vector,VTableTree-method asvec |
Layout with 1 column and zero rows | basic_table |
Retrieve and assign elements of a 'TableTree' | brackets [,VTableTree,logical,logical-method [<-,VTableTree,ANY,ANY,list-method |
Create a table from a layout and data | build_table |
Column-bind two 'TableTree' objects | cbind_rtables |
Retrieve cell values by row and column path | cell_values value_at value_at,VTableTree-method |
Constructor for Cell Value | CellValue |
Column information/structure accessors | clayout clayout,ANY-method clayout,PreDataTableLayouts-method clayout,VTableNodeInfo-method clayout<- clayout<-,PreDataTableLayouts-method coltree coltree,InstantiatedColumnInfo-method coltree,LayoutColTree-method coltree,PreDataColLayout-method coltree,PreDataTableLayouts-method coltree,TableRow-method coltree,VTableTree-method col_counts col_counts,InstantiatedColumnInfo-method col_counts,VTableNodeInfo-method col_counts<- col_counts<-,InstantiatedColumnInfo-method col_counts<-,VTableNodeInfo-method col_exprs col_exprs,InstantiatedColumnInfo-method col_exprs,PreDataColLayout-method col_exprs,PreDataTableLayouts-method col_info col_info,VTableNodeInfo-method col_info<- col_info<-,ElementaryTable-method col_info<-,TableRow-method col_info<-,TableTree-method col_total col_total,InstantiatedColumnInfo-method col_total,VTableNodeInfo-method col_total<- col_total<-,InstantiatedColumnInfo-method col_total<-,VTableNodeInfo-method |
Clear all indent modifiers from a table | clear_indent_mods clear_indent_mods,TableRow-method clear_indent_mods,VTableTree-method |
Value and Visibility of specific column counts by path | colcount_visible colcount_visible,InstantiatedColumnInfo-method colcount_visible,LayoutColTree-method colcount_visible,VTableTree-method colcount_visible<- colcount_visible<-,InstantiatedColumnInfo-method colcount_visible<-,LayoutColTree-method colcount_visible<-,VTableTree-method |
Collect leaves of a 'TableTree' | collect_leaves |
Display column tree structure | coltree_structure |
Compare two rtables | compare_rtables |
Compatibility argument conventions | compat_args |
Score functions for sorting 'TableTrees' | cont_n_allcols cont_n_onecol |
Retrieve or set content table from a 'TableTree' | content_table content_table<- |
Analysis function to count levels of a factor with percentage of the column total | counts_wpcts |
Custom split functions | custom_split_funs |
Generate a result data frame | as_result_df data.frame_export path_enriched_df result_df_specs |
Create an 'ElementaryTable' from a 'data.frame' | df_to_tt |
Apply basic split (for use in custom split functions) | do_base_split |
Pre-processing function for use in 'make_split_fun' | drop_facet_levels |
'TableTree' classes | ElementaryTable ElementaryTable-class TableTree TableTree-class |
Empty table, column, split objects | EmptyAllSplit EmptyColInfo EmptyElTable EmptyRootSplit |
Export as word document | export_as_docx margins_landscape margins_potrait section_properties_default |
Create enriched flat value table with paths | export_as_tsv import_from_tsv |
Get or set column count for a facet in column space | facet_colcount facet_colcount,InstantiatedColumnInfo-method facet_colcount,LayoutColLeaf-method facet_colcount,LayoutColTree-method facet_colcount,VTableTree-method facet_colcount<- facet_colcount<-,InstantiatedColumnInfo-method facet_colcount<-,LayoutColLeaf-method facet_colcount<-,LayoutColTree-method facet_colcount<-,VTableTree-method |
Set visibility of column counts for a group of sibling facets | facet_colcounts_visible<- |
Find degenerate (sub)structures within a table | find_degen_struct |
Format 'rcell' objects | format_rcell |
Get formatted cells | get_cell_aligns get_cell_aligns,ElementaryTable-method get_cell_aligns,LabelRow-method get_cell_aligns,TableRow-method get_cell_aligns,TableTree-method get_formatted_cells get_formatted_cells,ElementaryTable-method get_formatted_cells,LabelRow-method get_formatted_cells,TableRow-method get_formatted_cells,TableTree-method |
Head and tail methods | head head,VTableTree-method tail tail,VTableTree-method |
Access or recursively set header-body separator for tables | horizontal_sep horizontal_sep,VTableTree-method horizontal_sep<- horizontal_sep<-,TableRow-method horizontal_sep<-,VTableTree-method |
Create multiple rows in analysis or summary functions | in_rows |
Change indentation of all 'rrows' in an 'rtable' | indent |
Indent strings | indent_string |
Insert row at path | insert_row_at_path insert_row_at_path,VTableTree,ANY-method insert_row_at_path,VTableTree,DataRow-method |
Insert 'rrow's at (before) a specific location | insert_rrow |
Instantiated column info | InstantiatedColumnInfo InstantiatedColumnInfo-class |
Check if an object is a valid 'rtable' | is_rtable |
Label at path | label_at_path label_at_path<- |
Row classes and constructors | .tablerow ContentRow ContentRow-class DataRow DataRow-class LabelRow LabelRow-class |
Length of a Cell value | length,CellValue-method |
Returns a function that coerces the return values of a function to a list | list_wrap_df list_wrap_x |
Create a custom analysis function wrapping an existing function | make_afun |
Column layout summary | make_col_df |
Create a custom splitting function | make_split_fun |
Construct split result object | add_to_split_result make_split_result |
Manual column declaration | manual_cols |
Manually defined split | ManualSplit |
Transform an 'rtable' to a list of matrices which can be used for outputting | matrix_form,VTableTree-method |
Split between two or more different variables | MultiVarSplit |
Names of a 'TableTree' | names,InstantiatedColumnInfo-method names,LayoutColTree-method names,VTableNodeInfo-method row.names,VTableTree-method |
Exported for use in 'tern' | no_colinfo no_colinfo,InstantiatedColumnInfo-method no_colinfo,VTableNodeInfo-method |
Table dimensions | dim,VTableNodeInfo-method ncol,VTableNodeInfo-method nrow,VTableTree-method |
Row attribute accessors | obj_avar obj_avar,ElementaryTable-method obj_avar,TableRow-method row_cells row_cells,TableRow-method row_cells<- row_cells<-,TableRow-method row_values row_values,TableRow-method row_values<- row_values<-,LabelRow-method row_values<-,TableRow-method |
Methods for generics in the 'formatters' package | formatters_methods main_footer,TableRow-method main_footer,VTitleFooter-method main_footer<-,VTitleFooter-method main_title,TableRow-method main_title,VTitleFooter-method main_title<-,VTitleFooter-method make_row_df,LabelRow-method make_row_df,TableRow-method make_row_df,VTableTree-method nlines,InstantiatedColumnInfo-method nlines,LabelRow-method nlines,RefFootnote-method nlines,TableRow-method obj_format,CellValue-method obj_format,Split-method obj_format,VTableNodeInfo-method obj_format<-,CellValue-method obj_format<-,Split-method obj_format<-,VTableNodeInfo-method obj_label,Split-method obj_label,TableRow-method obj_label,ValueWrapper-method obj_label,VTableTree-method obj_label<-,Split-method obj_label<-,TableRow-method obj_label<-,ValueWrapper-method obj_label<-,VTableTree-method obj_name,Split-method obj_name,VNodeInfo-method obj_name<-,Split-method obj_name<-,VNodeInfo-method obj_na_str,Split-method prov_footer,TableRow-method prov_footer,VTitleFooter-method prov_footer<-,VTitleFooter-method subtitles,TableRow-method subtitles,VTitleFooter-method subtitles<-,VTitleFooter-method table_inset,PreDataTableLayouts-method table_inset,VTableNodeInfo-method table_inset<-,InstantiatedColumnInfo-method table_inset<-,PreDataTableLayouts-method table_inset<-,VTableNodeInfo-method |
Pagination of a 'TableTree' | paginate_table pag_tt_indices |
Recursively prune a 'TableTree' | prune_table |
Generalized frequency table | qtable qtable_layout |
Row-bind 'TableTree' and related objects | rbind rbind,VTableNodeInfo-method rbind2,VTableNodeInfo,ANY-method rbindl_rtables |
Cell value constructors | non_ref_rcell rcell |
Create a header | rheader |
Set all column counts at all levels of nesting to NA | rm_all_colcounts rm_all_colcounts,InstantiatedColumnInfo-method rm_all_colcounts,LayoutColLeaf-method rm_all_colcounts,LayoutColTree-method rm_all_colcounts,VTableTree-method |
Referential footnote accessors | cell_footnotes cell_footnotes<- col_fnotes_here col_fnotes_here,ANY-method col_fnotes_here<- col_footnotes col_footnotes<- fnotes_at_path<- ref_index ref_index<- ref_msg ref_symbol ref_symbol<- row_footnotes row_footnotes<- |
Get a list of table row/column paths | col_paths row_paths |
Print row/column paths summary | col_paths_summary row_paths_summary |
Create an 'rtable' row | rrow |
Create an 'rtable' row from a vector or list of values | rrowl |
Create a table | rtable rtablel |
Sanitize degenerate table structures | sanitize_table_struct |
Section dividers accessor and setter | header_section_div header_section_div,PreDataTableLayouts-method header_section_div,VTableTree-method header_section_div<- header_section_div<-,PreDataTableLayouts-method header_section_div<-,VTableTree-method section_div section_div,list-method section_div,TableRow-method section_div,VTableTree-method section_div<- section_div<-,LabelRow-method section_div<-,list-method section_div<-,TableRow-method section_div<-,VTableTree-method top_level_section_div top_level_section_div,PreDataTableLayouts-method top_level_section_div<- top_level_section_div<-,PreDataTableLayouts-method |
Split function argument conventions | sf_args |
Default tabulation | simple_analysis simple_analysis,ANY-method simple_analysis,factor-method simple_analysis,logical-method simple_analysis,numeric-method |
Sorting a table at a specific path | sort_at_path |
.spl_context within analysis and split functions | spl_context |
Translate spl_context to a path to display in error messages | spl_context_to_disp_path |
Variable associated with a split | spl_variable spl_variable,Split-method spl_variable,VarDynCutSplit-method spl_variable,VarLevelSplit-method spl_variable,VarStaticCutSplit-method |
Declaring a column-split based on levels of a variable | split_cols_by |
Split on static or dynamic cuts of the data | split_cols_by_cutfun split_cols_by_cuts split_cols_by_quartiles split_rows_by_cutfun split_rows_by_cuts split_rows_by_quartiles |
Associate multiple variables with columns | split_cols_by_multivar |
Split functions | drop_and_remove_levels drop_split_levels keep_split_levels remove_split_levels reorder_split_levels split_funcs trim_levels_in_group |
Add rows according to levels of a variable | split_rows_by |
Associate multiple variables with rows | split_rows_by_multivar |
Add a content row of summary counts | summarize_row_groups |
Table shells | table_shell table_shell_str |
Summarize table | table_structure |
Top left material | top_left top_left,InstantiatedColumnInfo-method top_left,PreDataTableLayouts-method top_left,VTableTree-method top_left<- top_left<-,InstantiatedColumnInfo-method top_left<-,PreDataTableLayouts-method top_left<-,VTableTree-method |
Convert an 'rtable' object to a string | tostring toString,VTableTree-method |
Retrieve or set the direct children of a tree-style object | tree_children tree_children<- |
Trim levels of another variable from each facet (post-processing split step) | trim_levels_in_facets |
Trim levels to map | trim_levels_to_map |
Trim rows from a populated table without regard for table structure | trim_rows |
Access or set table elements at specified path | tt_at_path tt_at_path<- |
Create a 'flextable' from an 'rtables' table | theme_docx_default theme_html_default tt_to_flextable word_mm_to_pt |
Update footnote indices on a built table | update_ref_indexing |
Validate and assert valid table structure | assert_valid_table validate_table_struct |
Value formats | value_formats value_formats,ANY-method value_formats,LabelRow-method value_formats,TableRow-method value_formats,VTableTree-method |
Split on levels within a variable | VarLevelSplit VarLevelSplit-class VarLevWBaselineSplit |
List variables required by a pre-data table layout | vars_in_layout vars_in_layout,CompoundSplit-method vars_in_layout,ManualSplit-method vars_in_layout,PreDataAxisLayout-method vars_in_layout,PreDataTableLayouts-method vars_in_layout,Split-method vars_in_layout,SplitVector-method |
Splits for cutting by values of a numeric variable | CumulativeCutSplit-class make_static_cut_split VarDynCutSplit VarDynCutSplit-class VarStaticCutSplit-class |
Display an 'rtable' object in the Viewer pane in RStudio or in a browser | Viewer |