Package index
-
tern
tern-package
- tern Package
-
analyze_functions
- Analyze functions
-
analyze_colvars_functions
- Analyze functions in columns
-
summarize_functions
- Summarize functions
-
formatting_functions
- Formatting functions
Analysis Functions
Analyze functions with their corresponding statistics functions and formatted analysis functions.
Analyze functions are used in combination with
rtables
layout functions in the pipeline which creates the table.Statistics functions (denoted by
s_
prefix) compute the numbers that are tabulated later. In order to separate computation from formatting, they do not take care ofrcell
type formatting themselves.Formatted analysis functions (denoted by
a_
prefix) have the same arguments as the corresponding statistics functions, and can be further customized by callingrtables::make_afun()
on them. They are used asafun
inrtables::analyze()
.
-
analyze_vars()
s_summary()
a_summary()
stable - Analyze variables
-
analyze_vars_in_cols()
experimental - Analyze numeric variables in columns
-
analyze_num_patients()
summarize_num_patients()
s_num_patients()
s_num_patients_content()
stable - Count number of patients
-
analyze_patients_exposure_in_cols()
summarize_patients_exposure_in_cols()
s_count_patients_sum_exposure()
a_count_patients_sum_exposure()
stable - Count number of patients and sum exposure across all patients in columns
-
compare_vars()
s_compare()
stable - Compare variables between groups
-
count_abnormal()
s_count_abnormal()
a_count_abnormal()
stable - Count patients with abnormal range values
-
count_abnormal_by_baseline()
s_count_abnormal_by_baseline()
a_count_abnormal_by_baseline()
stable - Count patients with abnormal analysis range values by baseline status
-
count_abnormal_by_marked()
s_count_abnormal_by_marked()
a_count_abnormal_by_marked()
stable - Count patients with marked laboratory abnormalities
-
count_abnormal_by_worst_grade()
s_count_abnormal_by_worst_grade()
a_count_abnormal_by_worst_grade()
stable - Count patients by most extreme post-baseline toxicity grade per direction of abnormality
-
count_abnormal_lab_worsen_by_baseline()
s_count_abnormal_lab_worsen_by_baseline()
a_count_abnormal_lab_worsen_by_baseline()
stable - Count patients with toxicity grades that have worsened from baseline by highest grade post-baseline
-
count_cumulative()
s_count_cumulative()
a_count_cumulative()
stable - Cumulative counts of numeric variable by thresholds
-
count_missed_doses()
s_count_nonmissing()
s_count_missed_doses()
a_count_missed_doses()
stable - Count number of patients with missed doses by thresholds
-
count_occurrences()
summarize_occurrences()
s_count_occurrences()
a_count_occurrences()
stable - Count occurrences
-
count_occurrences_by_grade()
summarize_occurrences_by_grade()
s_count_occurrences_by_grade()
a_count_occurrences_by_grade()
stable - Count occurrences by grade
-
summarize_patients_events_in_cols()
s_count_patients_and_multiple_events()
stable - Count patient events in columns
-
count_patients_with_event()
s_count_patients_with_event()
a_count_patients_with_event()
stable - Count the number of patients with a particular event
-
count_patients_with_flags()
s_count_patients_with_flags()
a_count_patients_with_flags()
stable - Count the number of patients with particular flags
-
count_values()
s_count_values()
a_count_values()
stable - Count specific values
-
estimate_multinomial_response()
s_length_proportion()
a_length_proportion()
stable - Estimate proportions of each level of a variable
-
estimate_proportion()
s_proportion()
a_proportion()
stable - Proportion estimation
-
estimate_incidence_rate()
s_incidence_rate()
a_incidence_rate()
stable - Incidence rate estimation
-
estimate_odds_ratio()
s_odds_ratio()
a_odds_ratio()
stable - Odds ratio estimation
-
estimate_proportion_diff()
s_proportion_diff()
a_proportion_diff()
stable - Proportion difference estimation
-
s_bland_altman()
experimental - Bland-Altman analysis
-
summarize_coxreg()
s_coxreg()
a_coxreg()
stable - Cox proportional hazards regression
-
summarize_ancova()
s_ancova()
a_ancova()
stable - Summarize analysis of covariance (ANCOVA) results
-
summarize_change()
s_change_from_baseline()
a_change_from_baseline()
stable - Summarize change from baseline values or absolute baseline values
-
summarize_colvars()
stable - Summarize variables in columns
-
summarize_glm_count()
s_glm_count()
experimental - Summarize Poisson negative binomial regression
-
summarize_logistic()
stable - Multivariate logistic regression table
-
surv_time()
s_surv_time()
a_surv_time()
stable - Survival time analysis
-
surv_timepoint()
s_surv_timepoint()
a_surv_timepoint()
s_surv_timepoint_diff()
a_surv_timepoint_diff()
stable - Survival time point analysis
-
tabulate_rsp_biomarkers()
stable - Tabulate biomarker effects on binary response by subgroup
-
tabulate_rsp_subgroups()
a_response_subgroups()
stable - Tabulate binary response by subgroup
-
tabulate_survival_biomarkers()
stable - Tabulate biomarker effects on survival by subgroup
-
tabulate_survival_subgroups()
a_survival_subgroups()
stable - Tabulate survival duration by subgroup
-
test_proportion_diff()
s_test_proportion_diff()
a_test_proportion_diff()
stable - Difference test for two proportions
Model-Specific Functions
These functions help with fitting or extracting results from specific models.
-
estimate_coef()
- Hazard ratio estimation in interactions
-
extract_rsp_biomarkers()
stable - Prepare response data estimates for multiple biomarkers in a single data frame
-
extract_rsp_subgroups()
stable - Prepare response data for population subgroups in data frames
-
extract_survival_biomarkers()
stable - Prepare survival data estimates for multiple biomarkers in a single data frame
-
extract_survival_subgroups()
stable - Prepare survival data for population subgroups in data frames
-
fit_coxreg_univar()
fit_coxreg_multivar()
stable - Fitting functions for Cox proportional hazards regression
-
fit_logistic()
stable - Fit for logistic regression
-
fit_rsp_step()
stable - Subgroup treatment effect pattern (STEP) fit for binary (response) outcome
-
fit_survival_step()
stable - Subgroup treatment effect pattern (STEP) fit for survival outcome
-
get_smooths()
stable - Smooth function with optional grouping
-
logistic_regression_cols()
stable - Logistic regression multivariate column layout function
-
logistic_summary_by_flag()
stable - Logistic regression summary table
-
tidy(<glm>)
stable - Custom tidy method for binomial GLM results
-
tidy(<step>)
stable - Custom tidy method for STEP results
-
tidy(<summary.coxph>)
tidy(<coxreg.univar>)
tidy(<coxreg.multivar>)
stable - Custom tidy methods for Cox regression
-
univariate()
stable - Univariate formula special term
-
g_bland_altman()
experimental - Bland-Altman plot
-
g_forest()
stable - Create a forest plot from an
rtable
-
g_ipp()
stable - Individual patient plots
-
g_km()
stable - Kaplan-Meier plot
-
g_lineplot()
stable - Line plot with optional table
-
g_step()
stable - Create a STEP graph
-
g_waterfall()
stable - Horizontal waterfall plot
Control Functions
These functions capture options in lists and take care of defaults (and checks where applicable). They avoid cluttering of function signatures with long lists of single arguments.
-
control_analyze_vars()
stable - Control function for descriptive statistics
-
control_surv_med_annot()
control_coxph_annot()
stable - Control functions for Kaplan-Meier plot annotation tables
-
control_coxph()
stable - Control function for Cox-PH model
-
control_coxreg()
stable - Control function for Cox regression
-
control_incidence_rate()
stable - Control function for incidence rate
-
control_lineplot_vars()
stable - Control function for
g_lineplot()
-
control_logistic()
stable - Control function for logistic regression model fitting
-
control_riskdiff()
stable - Control function for risk difference column
-
control_step()
stable - Control function for subgroup treatment effect pattern (STEP) calculations
-
control_surv_time()
stable - Control function for
survfit
models for survival time
-
control_surv_timepoint()
stable - Control function for
survfit
models for patients' survival rate at time points
-
get_stats()
get_formats_from_stats()
get_labels_from_stats()
get_indents_from_stats()
tern_default_stats
tern_default_formats
tern_default_labels
summary_formats()
summary_labels()
stable - Get default statistical methods and their associated formats, labels, and indent modifiers
-
h_coxreg_inter_effect()
h_coxreg_extract_interaction()
h_coxreg_inter_estimations()
stable - Cox regression helper function for interactions
-
h_get_format_threshold()
h_format_threshold()
stable - Format extreme values
-
h_adlb_abnormal_by_worst_grade()
stable - Helper function to prepare ADLB for
count_abnormal_by_worst_grade()
-
h_adlb_worsen()
stable - Helper function to prepare ADLB with worst labs
-
h_adsl_adlb_merge_using_worst_flag()
stable - Helper function for deriving analysis datasets for select laboratory tables
-
h_ancova()
stable - Helper function to return results of a linear model
-
h_append_grade_groups()
stable - Helper function for
s_count_occurrences_by_grade()
-
h_count_cumulative()
stable - Helper function for
s_count_cumulative()
-
h_coxreg_univar_formulas()
h_coxreg_multivar_formula()
h_coxreg_univar_extract()
h_coxreg_multivar_extract()
stable - Helper functions for Cox proportional hazards regression
-
h_decompose_gg()
deprecated -
ggplot
decomposition
-
h_format_row()
stable - Helper function to format the optional
g_lineplot
table
-
h_ggkm()
deprecated - Helper function to create a KM plot
-
h_km_layout()
deprecated - Helper function to prepare a KM layout
-
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()
stable - Helper functions for multivariate logistic regression
-
h_map_for_count_abnormal()
stable - Helper function to create a map data frame for
trim_levels_to_map()
-
or_glm()
or_clogit()
stable - Helper functions for odds ratio estimation
-
h_pkparam_sort()
stable - Sort pharmacokinetic data by
PARAM
variable
-
h_ppmeans()
- Function to return the estimated means using predicted probabilities
-
prop_diff_wald()
prop_diff_ha()
prop_diff_nc()
prop_diff_cmh()
prop_diff_strat_nc()
stable - Helper functions to calculate proportion difference
-
prop_wilson()
prop_strat_wilson()
prop_clopper_pearson()
prop_wald()
prop_agresti_coull()
prop_jeffreys()
stable - Helper functions for calculating proportion confidence intervals
-
h_rsp_to_logistic_variables()
h_logistic_mult_cont_df()
h_tab_rsp_one_biomarker()
stable - Helper functions for tabulating biomarker effects on binary response by subgroup
-
h_proportion_df()
h_proportion_subgroups_df()
h_odds_ratio_df()
h_odds_ratio_subgroups_df()
stable - Helper functions for tabulating binary response by subgroup
-
h_split_by_subgroups()
stable - Split data frame by subgroups
-
h_split_param()
stable - Split parameters
-
h_stack_by_baskets()
stable - 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()
stable - Helper functions for subgroup treatment effect pattern (STEP) calculations
-
h_surv_to_coxreg_variables()
h_coxreg_mult_cont_df()
h_tab_surv_one_biomarker()
stable - Helper functions for tabulating biomarker effects on survival by subgroup
-
h_survtime_df()
h_survtime_subgroups_df()
h_coxph_df()
h_coxph_subgroups_df()
stable - Helper functions for tabulating survival duration by subgroup
-
h_tab_one_biomarker()
stable - Helper function for tabulation of a single biomarker result
-
h_tbl_coxph_pairwise()
stable - Helper function for generating a pairwise Cox-PH table
-
h_tbl_median_surv()
stable - Helper function for survival estimations
-
h_worsen_counter()
stable - Helper function to analyze patients for
s_count_abnormal_lab_worsen_by_baseline()
-
imputation_rule()
stable - Apply 1/3 or 1/2 imputation rule to data
-
labels_use_control()
stable - Update labels according to control specifications
rtables Helper Functions
These functions help to work with the rtables
package and may be moved there later.
-
add_riskdiff()
stable - Split function to configure risk difference column
-
add_rowcounts()
stable - Layout-creating function to add row total counts
-
append_varlabels()
stable - Add variable labels to top left corner in table
-
default_na_str()
set_default_na_str()
stable - Default string replacement for
NA
values
-
as.rtable()
stable - Convert to
rtable
-
combine_counts()
- Combine counts
-
combine_groups()
stable - Reference and treatment group combination
-
combine_levels()
stable - Combine factor levels
-
combine_vectors()
- Element-wise combination of two vectors
-
h_col_indices()
stable - Obtain column indices
-
h_row_first_values()
h_row_counts()
h_row_fractions()
h_col_counts()
h_content_first_row()
is_leaf_table()
check_names_indices()
stable - Helper functions for accessing information from
rtables
-
rtable2gg()
experimental - Convert
rtable
objects toggplot
objects
-
split_cols_by_groups()
stable - Split columns by groups of levels
-
to_string_matrix()
stable - Convert table into matrix of strings
-
groups_list_to_df()
- Convert list of groups to a data frame
-
ref_group_position()
level_order()
stable - Custom split functions
rtables Formatting Functions
These functions provide customized formatting rules to work with the rtables
package.
-
format_auto()
stable - Format automatically using data significant digits
-
format_count_fraction()
stable - Format count and fraction
-
format_count_fraction_fixed_dp()
experimental - Format count and percentage with fixed single decimal place
-
format_count_fraction_lt10()
stable - Format count and fraction with special case for count < 10
-
format_extreme_values()
stable - Format a single extreme value
-
format_extreme_values_ci()
stable - Format extreme values part of a confidence interval
-
format_fraction()
stable - Format fraction and percentage
-
format_fraction_fixed_dp()
stable - Format fraction and percentage with fixed single decimal place
-
format_fraction_threshold()
stable - Format fraction with lower threshold
-
format_sigfig()
- Format numeric values by significant figures
-
format_xx()
- Format XX as a formatting function
-
score_occurrences()
score_occurrences_cols()
score_occurrences_subtable()
score_occurrences_cont_cols()
stable - Occurrence table sorting
-
`&`(<CombinationFunction>,<CombinationFunction>)
`|`(<CombinationFunction>,<CombinationFunction>)
`!`(<CombinationFunction>)
stable - Class for
CombinationFunction
-
decorate_grob()
stable - Add titles, footnotes, page Number, and a bounding box to a grid grob
-
split_text_grob()
- Split text according to available text width
-
decorate_grob_factory()
- Update page number
-
decorate_grob_set()
stable - Decorate set of
grob
s and add page numbering
-
h_g_ipp()
stable - Helper function to create simple line plot over time
-
h_xticks()
stable - Helper function to calculate x-tick positions
-
aesi_label()
stable - 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()
stable - Combine factor levels
-
cut_quantile_bins()
stable - Cut numeric vector into empirical quantile bins
-
day2month()
- Conversion of days to months
-
df_explicit_na()
stable - Encode categorical missing values in a data frame
-
d_count_abnormal_by_baseline()
stable - Description function for
s_count_abnormal_by_baseline()
-
d_count_cumulative()
stable - Description of cumulative count
-
d_count_missed_doses()
stable - Description function that calculates labels for
s_count_missed_doses()
-
d_onco_rsp_label()
stable - Description of standard oncology response
-
d_pkparam()
stable - Generate PK reference dataset
-
d_proportion()
stable - Description of the proportion summary
-
d_proportion_diff()
stable - Description of method used for proportion comparison
-
d_rsp_subgroups_colvars()
stable - Labels for column variables in binary response by subgroup table
-
d_survival_subgroups_colvars()
stable - Labels for column variables in survival duration by subgroup table
-
d_test_proportion_diff()
stable - Description of the difference test between two proportions
-
explicit_na()
stable - Missing data
-
fct_collapse_only()
stable - Collapse factor levels and keep only those new group levels
-
fct_discard()
stable - Discard specified levels of a factor
-
fct_explicit_na_if()
stable - Insertion of explicit missing values in a factor
-
f_conf_level()
stable - Utility function to create label for confidence interval
-
f_pval()
stable - Utility function to create label for p-value
-
h_data_plot()
stable - Helper function to tidy survival fit data
-
month2day()
stable - Conversion of months to days
-
reapply_varlabels()
- Reapply variable labels
-
sas_na()
stable - Convert strings to
NA
-
stat_mean_ci()
stable - Confidence interval for mean
-
stat_mean_pval()
stable - p-Value of the mean
-
stat_median_ci()
stable - Confidence interval for median
-
stat_propdiff_ci()
stable - Proportion difference and confidence interval
-
strata_normal_quantile()
stable - Helper function for the estimation of stratified quantiles
-
to_n()
stable - Replicate entries of a vector if required
-
update_weights_strat_wilson()
stable - Helper function for the estimation of weights for
prop_strat_wilson()
-
assert_list_of_variables()
assert_df_with_variables()
assert_valid_factor()
assert_df_with_factors()
assert_proportion_value()
- Additional assertions to use with
checkmate
-
tern_ex_adsl
tern_ex_adae
tern_ex_adlb
tern_ex_adpp
tern_ex_adrs
tern_ex_adtte
- Simulated CDISC data for examples
-
forest_viewport()
deprecated - Create a viewport tree for the forest plot
-
h_decompose_gg()
deprecated -
ggplot
decomposition
-
h_ggkm()
deprecated - Helper function to create a KM plot
-
h_grob_coxph()
deprecated - Helper function to create Cox-PH grobs
-
h_grob_median_surv()
deprecated - Helper function to create survival estimation grobs
-
h_grob_tbl_at_risk()
deprecated - Helper function to create patient-at-risk grobs
-
h_grob_y_annot()
deprecated - Helper function to create grid object with y-axis annotation
-
h_km_layout()
deprecated - Helper function to prepare a KM layout
-
stack_grobs()
deprecated - Stack multiple grobs
-
arrange_grobs()
deprecated - Arrange multiple grobs
-
draw_grob()
deprecated - Draw
grob