Skip to contents

Overview Pages

tern tern-package
tern Package
formatting_functions
Additional Formatting Functions
kaplan_meier
Kaplan-Meier Plot

Control Functions

Control functions capture options in lists, and take care of defaults (and if it makes sense also checks). They avoid cluttering of function signatures with long lists of single arguments.

control_coxph()
Control Function for CoxPH Model
control_coxreg()
Controls for Cox regression
control_incidence_rate()
Control function for incidence rate
control_lineplot_vars()
Control Function for g_lineplot Function
control_logistic()
Control Function for Logistic Regression Model Fitting
control_step()
Control Function for Subgroup Treatment Effect Pattern (STEP) Calculations
control_summarize_vars()
Control Function for Descriptive Statistics
control_surv_time()
Control Function for survfit Model for Survival Time
control_surv_timepoint()
Control Function for survfit Model for Patient's Survival Rate at time point

Statistics Functions

Statistics functions should do the computation of the numbers that are tabulated later. In order to separate computation from formatting, they should not take care of rcell type formatting themselves.

s_compare() a_compare() create_afun_compare() compare_vars()
Compare Variables Between Groups
h_count_cumulative() s_count_cumulative() a_count_cumulative() count_cumulative()
Cumulative Counts with Thresholds
s_count_nonmissing() d_count_missed_doses() s_count_missed_doses() a_count_missed_doses() count_missed_doses()
Counting Missed Doses
s_count_occurrences() a_count_occurrences() count_occurrences()
Occurrence Counts
h_append_grade_groups() s_count_occurrences_by_grade() a_count_occurrences_by_grade() count_occurrences_by_grade() summarize_occurrences_by_grade()
Occurrence Counts by Grade
s_count_patients_and_multiple_events() summarize_patients_events_in_cols()
Counting Patients and Events in Columns
s_count_patients_with_event() a_count_patients_with_event() count_patients_with_event() s_count_patients_with_flags() a_count_patients_with_flags() count_patients_with_flags()
Count the Number of Patients with a Particular Event
s_count_values() count_values() a_count_values()
Counting Specific Values
h_coxreg_univar_formulas() h_coxreg_multivar_formula() fit_coxreg_univar() tidy(<summary.coxph>) h_coxreg_univar_extract() tidy(<coxreg.univar>) fit_coxreg_multivar() h_coxreg_multivar_extract() tidy(<coxreg.multivar>) s_coxreg() summarize_coxreg()
Cox Proportional Hazards Regression
d_onco_rsp_label() s_length_proportion() a_length_proportion() estimate_multinomial_response()
Estimation of Proportions per Level of Factor
s_num_patients() s_num_patients_content() summarize_num_patients()
Number of patients
or_glm() or_clogit() s_odds_ratio() a_odds_ratio() estimate_odds_ratio()
Odds Ratio Estimation
prop_wilson() prop_strat_wilson() prop_clopper_pearson() prop_wald() prop_agresti_coull() prop_jeffreys() s_proportion() a_proportion() estimate_proportion()
Estimation of Proportions
d_proportion_diff() prop_diff_wald() prop_diff_ha() prop_diff_nc() prop_diff_cmh() prop_diff_strat_nc() s_proportion_diff() a_proportion_diff() estimate_proportion_diff()
Proportion Difference
s_summary() a_summary() create_afun_summary() summarize_vars()
Summarize Variables

Formatted Analysis functions

These have the same arguments as the corresponding statistics functions, and can be further customized by calling rtables::make_afun() on them. They are used as afun in rtables::analyze().

Analyze Functions

Analyze Functions are used in combination with the rtables layout functions, in the pipeline which creates the table.

s_compare() a_compare() create_afun_compare() compare_vars()
Compare Variables Between Groups
s_count_abnormal() a_count_abnormal() count_abnormal()
Patient Counts with Abnormal Range Values
d_count_abnormal_by_baseline() s_count_abnormal_by_baseline() a_count_abnormal_by_baseline() count_abnormal_by_baseline()
Patient Counts with Abnormal Range Values by Baseline Status
s_count_abnormal_by_marked() a_count_abnormal_by_marked() count_abnormal_by_marked()
Count patients with marked laboratory abnormalities
s_count_abnormal_by_worst_grade() a_count_abnormal_by_worst_grade() count_abnormal_by_worst_grade()
Patient Counts with the Most Extreme Post-baseline Toxicity Grade per Direction of Abnormality
h_adlb_worsen() h_worsen_counter() s_count_abnormal_lab_worsen_by_baseline() a_count_abnormal_lab_worsen_by_baseline() count_abnormal_lab_worsen_by_baseline()
Patient Counts for Laboratory Events (Worsen From Baseline) by Highest Grade Post-Baseline
h_count_cumulative() s_count_cumulative() a_count_cumulative() count_cumulative()
Cumulative Counts with Thresholds
s_count_nonmissing() d_count_missed_doses() s_count_missed_doses() a_count_missed_doses() count_missed_doses()
Counting Missed Doses
s_count_occurrences() a_count_occurrences() count_occurrences()
Occurrence Counts
h_append_grade_groups() s_count_occurrences_by_grade() a_count_occurrences_by_grade() count_occurrences_by_grade() summarize_occurrences_by_grade()
Occurrence Counts by Grade
s_count_patients_with_event() a_count_patients_with_event() count_patients_with_event() s_count_patients_with_flags() a_count_patients_with_flags() count_patients_with_flags()
Count the Number of Patients with a Particular Event
s_count_values() count_values() a_count_values()
Counting Specific Values
s_incidence_rate() a_incidence_rate() estimate_incidence_rate() h_incidence_rate_normal() h_incidence_rate_normal_log() h_incidence_rate_exact() h_incidence_rate_byar() h_incidence_rate()
Incidence rate
d_onco_rsp_label() s_length_proportion() a_length_proportion() estimate_multinomial_response()
Estimation of Proportions per Level of Factor
or_glm() or_clogit() s_odds_ratio() a_odds_ratio() estimate_odds_ratio()
Odds Ratio Estimation
prop_wilson() prop_strat_wilson() prop_clopper_pearson() prop_wald() prop_agresti_coull() prop_jeffreys() s_proportion() a_proportion() estimate_proportion()
Estimation of Proportions
d_proportion_diff() prop_diff_wald() prop_diff_ha() prop_diff_nc() prop_diff_cmh() prop_diff_strat_nc() s_proportion_diff() a_proportion_diff() estimate_proportion_diff()
Proportion Difference
extract_rsp_biomarkers() tabulate_rsp_biomarkers()
Tabulate Biomarker Effects on Binary Response by Subgroup
h_ancova() s_ancova() a_ancova() summarize_ancova()
Summary for analysis of covariance (ANCOVA).
s_change_from_baseline() a_change_from_baseline() summarize_change()
Summarize the Change from Baseline or Absolute Baseline Values
summarize_colvars()
Summarize Variables in Columns
h_coxreg_univar_formulas() h_coxreg_multivar_formula() fit_coxreg_univar() tidy(<summary.coxph>) h_coxreg_univar_extract() tidy(<coxreg.univar>) fit_coxreg_multivar() h_coxreg_multivar_extract() tidy(<coxreg.multivar>) s_coxreg() summarize_coxreg()
Cox Proportional Hazards Regression
fit_logistic() h_get_interaction_vars() h_interaction_coef_name() h_or_cat_interaction() h_or_cont_interaction() h_or_interaction() h_simple_term_labels() h_interaction_term_labels() h_glm_simple_term_extract() h_glm_interaction_extract() h_glm_inter_term_extract() h_logistic_simple_terms() h_logistic_inter_terms() tidy(<glm>) logistic_regression_cols() logistic_summary_by_flag() summarize_logistic()
Multi-variable logistic regression table
s_num_patients() s_num_patients_content() summarize_num_patients()
Number of patients
s_count_patients_and_multiple_events() summarize_patients_events_in_cols()
Counting Patients and Events in Columns
s_count_patients_sum_exposure() summarize_patients_exposure_in_cols()
Counting Patients Summing Exposure Across All Patients in Columns
summary_in_cols() summarize_vars_in_cols()
Summary numeric variables in columns
s_summary() a_summary() create_afun_summary() summarize_vars()
Summarize Variables
extract_rsp_subgroups() a_response_subgroups() tabulate_rsp_subgroups()
Tabulate Binary Response by Subgroup
extract_survival_biomarkers() tabulate_survival_biomarkers()
Tabulate Biomarker Effects on Survival by Subgroup
extract_survival_subgroups() a_survival_subgroups() tabulate_survival_subgroups()
Tabulate Survival Duration by Subgroup
prop_chisq() prop_schouten() prop_fisher() prop_cmh() s_test_proportion_diff() a_test_proportion_diff() test_proportion_diff()
Difference Test for Two Proportions

Analysis Helper Functions

These functions are useful to help definining the analysis.

`add_footnotes<-`()
Add Footnotes
footnotes()
Retrieve Footnotes
`footnotes<-`()
Assign Footnotes
h_adlb_worsen() h_worsen_counter() s_count_abnormal_lab_worsen_by_baseline() a_count_abnormal_lab_worsen_by_baseline() count_abnormal_lab_worsen_by_baseline()
Patient Counts for Laboratory Events (Worsen From Baseline) by Highest Grade Post-Baseline
h_adsl_adlb_merge_using_worst_flag()
Helper Function for Deriving Analysis Datasets for LBT13 and LBT14
h_ancova() s_ancova() a_ancova() summarize_ancova()
Summary for analysis of covariance (ANCOVA).
h_append_grade_groups() s_count_occurrences_by_grade() a_count_occurrences_by_grade() count_occurrences_by_grade() summarize_occurrences_by_grade()
Occurrence Counts by Grade
h_col_indices()
Obtain Column Indices
h_count_cumulative() s_count_cumulative() a_count_cumulative() count_cumulative()
Cumulative Counts with Thresholds
h_survtime_df() h_survtime_subgroups_df() h_coxph_df() h_coxph_subgroups_df()
Helper Functions for Tabulating Survival Duration by Subgroup
h_coxreg_inter_effect() h_coxreg_extract_interaction() h_coxreg_inter_estimations()
Cox Regression Helper: Interactions
h_surv_to_coxreg_variables() h_coxreg_mult_cont_df() h_tab_surv_one_biomarker()
Helper Functions for Tabulating Biomarker Effects on Survival by Subgroup
h_coxreg_univar_formulas() h_coxreg_multivar_formula() fit_coxreg_univar() tidy(<summary.coxph>) h_coxreg_univar_extract() tidy(<coxreg.univar>) fit_coxreg_multivar() h_coxreg_multivar_extract() tidy(<coxreg.multivar>) s_coxreg() summarize_coxreg()
Cox Proportional Hazards Regression
h_decompose_gg()
ggplot Decomposition
h_get_format_threshold() h_format_threshold() format_extreme_values() format_extreme_values_ci()
Formatting Extreme Values
h_format_row()
Helper function to get the right formatting in the optional table in g_lineplot.
fit_logistic() h_get_interaction_vars() h_interaction_coef_name() h_or_cat_interaction() h_or_cont_interaction() h_or_interaction() h_simple_term_labels() h_interaction_term_labels() h_glm_simple_term_extract() h_glm_interaction_extract() h_glm_inter_term_extract() h_logistic_simple_terms() h_logistic_inter_terms() tidy(<glm>) logistic_regression_cols() logistic_summary_by_flag() summarize_logistic()
Multi-variable logistic regression table
h_ggkm()
Helper function: KM plot
s_incidence_rate() a_incidence_rate() estimate_incidence_rate() h_incidence_rate_normal() h_incidence_rate_normal_log() h_incidence_rate_exact() h_incidence_rate_byar() h_incidence_rate()
Incidence rate
h_km_layout()
Helper: KM Layout
h_rsp_to_logistic_variables() h_logistic_mult_cont_df() h_tab_rsp_one_biomarker()
Helper Functions for Tabulating Biomarker Effects on Binary Response by Subgroup
h_map_for_count_abnormal()
Helper Function to create a map dataframe that can be used in trim_levels_to_map split function.
h_proportion_df() h_proportion_subgroups_df() h_odds_ratio_df() h_odds_ratio_subgroups_df()
Helper Functions for Tabulating Binary Response by Subgroup
h_pkparam_sort()
Sort PK PARAM variable
h_recycle() desctools_binom() desctools_binomci()
Confidence Intervals for a Difference of Binomials
h_split_by_subgroups()
Split Dataframe by Subgroups
h_split_param()
Split parameters
h_stack_by_baskets()
Helper Function to create a new SMQ variable in ADAE by stacking SMQ and/or CQ records.
h_step_window() h_step_trt_effect() h_step_survival_formula() h_step_survival_est() h_step_rsp_formula() h_step_rsp_est()
Helper Functions for Subgroup Treatment Effect Pattern (STEP) Calculations
h_tab_one_biomarker()
Helper Function for Tabulation of a Single Biomarker Result
h_tbl_coxph_pairwise()
Helper Function: Pairwise CoxPH table
h_tbl_median_surv()
Helper Function: Survival Estimations
or_glm() or_clogit() s_odds_ratio() a_odds_ratio() estimate_odds_ratio()
Odds Ratio Estimation
d_proportion_diff() prop_diff_wald() prop_diff_ha() prop_diff_nc() prop_diff_cmh() prop_diff_strat_nc() s_proportion_diff() a_proportion_diff() estimate_proportion_diff()
Proportion Difference

Model Specific Functions

These functions help with fitting or extracting results from specific models.

Graphs

Functions that creates graphical type of the output.

g_forest()
Create a Forest Plot based on a Table
h_g_ipp() g_ipp()
Individual Patient Plots
g_km()
Kaplan-Meier Plot
g_lineplot()
Line plot with the optional table
g_step() tidy(<step>)
Create a STEP Graph
g_waterfall()
Horizontal Waterfall Plot

rtables Helper Functions

These functions help to work with the new rtables package and might be moved there later.

add_rowcounts()
Layout Creating Function to Add Row Total Counts
append_varlabels()
Add Variable Labels to Top Left Corner in Table
as.rtable()
Convert to rtable
combine_groups()
Reference and Treatment Group Combination
combine_vectors()
Combine Two Vectors Element Wise
h_row_counts() h_row_fractions() h_col_counts() is_leaf_table() h_content_first_row()
rtables Access Helper Functions
h_col_indices()
Obtain Column Indices
split_cols_by_groups()
Split Columns by Groups of Levels
to_string_matrix()
Convert Table into Matrix of Strings

rtables Formatting Functions

These functions provide customized formatting rules to work with the rtables package.

format_count_fraction()
Formatting Count and Fraction
h_get_format_threshold() h_format_threshold() format_extreme_values() format_extreme_values_ci()
Formatting Extreme Values
format_fraction()
Formatting Fraction and Percentage
format_fraction_threshold()
Formatting Fraction with Lower Threshold
format_xx()
Formatting: XX as Formatting Function

rtables Scoring Functions

These functions can help with sorting of tables.

rtables Pruning Functions

These functions and classes help with flexible pruning of tables.

Graphs Helper Functions

These functions are useful to modify graphs.

arrange_grobs()
Arrange Multiple Grobs
decorate_grob()
Add Titles, Footnotes, Page Number, and a Bounding Box to a Grid Grob
decorate_grob_factory()
Update Page Number
decorate_grob_set()
Decorate Set of grobs and Add Page Numbering
draw_grob()
Draw grob
h_g_ipp() g_ipp()
Individual Patient Plots
h_grob_coxph()
Helper Function: CoxPH Grob
h_grob_median_surv()
Helper Function: Survival Estimation Grob
h_grob_tbl_at_risk()
Helper: Patient-at-Risk Grobs
h_grob_y_annot()
Helper: Grid Object with y-axis Annotation
h_xticks()
Helper function: x tick positions
stack_grobs()
Stack Multiple Grobs
stat_mean_ci()
Confidence Interval for Mean
stat_mean_pval()
p-Value of the Mean
stat_median_ci()
Confidence Interval for Median

Data Helper Functions

These functions are used by other functions to derive data.

aesi_label()
Labels for Adverse Event Baskets
as_factor_keep_attributes()
Conversion of a Vector to a Factor
bins_percent_labels()
Labels for Bins in Percent
combine_levels()
Combine Factor Levels
cut_quantile_bins()
Cutting Numeric Vector into Empirical Quantile Bins
day2month()
Conversion of Days to Months
month2day()
Conversion of Months to Days
df_explicit_na()
Encode Categorical Missing Values in a Data Frame
d_onco_rsp_label() s_length_proportion() a_length_proportion() estimate_multinomial_response()
Estimation of Proportions per Level of Factor
d_count_abnormal_by_baseline() s_count_abnormal_by_baseline() a_count_abnormal_by_baseline() count_abnormal_by_baseline()
Patient Counts with Abnormal Range Values by Baseline Status
s_count_nonmissing() d_count_missed_doses() s_count_missed_doses() a_count_missed_doses() count_missed_doses()
Counting Missed Doses
d_count_cumulative()
Description of Cumulative Count
d_pkparam()
Generate PK reference dataset
d_proportion()
Description of the Proportion Summary
d_proportion_diff() prop_diff_wald() prop_diff_ha() prop_diff_nc() prop_diff_cmh() prop_diff_strat_nc() s_proportion_diff() a_proportion_diff() estimate_proportion_diff()
Proportion Difference
d_rsp_subgroups_colvars()
Labels for Column Variables in Binary Response by Subgroup Table
d_survival_subgroups_colvars()
Labels for Column Variables in Survival Duration by Subgroup Table
d_test_proportion_diff()
Description of the Difference Test Between Two Proportions
explicit_na()
Missing Data
fct_collapse_only()
Collapsing of Factor Levels and Keeping Only Those New Group Levels
fct_discard()
Discard Certain Levels from a Factor
fct_explicit_na_if()
Insertion of Explicit Missings in a Factor
f_conf_level()
Utility function to create label for confidence interval
f_pval()
Utility function to create label for p-value
h_data_plot()
Helper function: tidy survival fit
sas_na()
Convert Strings to NA
to_n()
Replicate Entries of a Vector if Required

Assertion Functions

These functions supplement those in the checkmate package.

Deprecated Functions

These functions already are or will eventually be removed.