# Create Common TLGs Used in Clinical Trials

## Documentation for package ‘tern’ version 0.9.8

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

A B C D E F G H I K L M O P R S T U misc

tern-package | tern Package

## -- A --

add_riskdiff | Split function to configure risk difference column
add_rowcounts | Layout-creating function to add row total counts
aesi_label | Labels for adverse event baskets
analyze_colvars_functions | Analyze functions in columns
analyze_functions | Analyze functions
analyze_variables | Analyze variables
analyze_vars | Analyze variables
analyze_vars_in_cols | Analyze numeric variables in columns
append_varlabels | Add variable labels to top left corner in table
arrange_grobs | Arrange multiple grobs
as.rtable | Convert to 'rtable'
as.rtable.data.frame | Convert to 'rtable'
as_factor_keep_attributes | Factor utilities
a_count_occurrences | Count occurrences
a_count_occurrences_by_grade | Count occurrences by grade
a_count_patients_with_event | Count the number of patients with a particular event
a_count_patients_with_flags | Count the number of patients with particular flags
a_count_values | Count specific values
a_coxreg | Cox proportional hazards regression
a_length_proportion | Estimate proportions of each level of a variable
a_odds_ratio | Odds ratio estimation
a_proportion | Proportion estimation
a_proportion_diff | Proportion difference estimation
a_summary | Analyze variables

## -- B --

bland_altman | Bland-Altman plot

## -- C --

CombinationFunction | Class for 'CombinationFunction'
CombinationFunction-class | Class for 'CombinationFunction'
combination_function | Class for 'CombinationFunction'
combine_counts | Combine counts
combine_groups | Reference and treatment group combination
combine_levels | Factor utilities
combine_vectors | Element-wise combination of two vectors
compare_variables | Compare variables between groups
compare_vars | Compare variables between groups
control_analyze_vars | Control function for descriptive statistics
control_annot | Control functions for Kaplan-Meier plot annotation tables
control_coxph | Control function for Cox-PH model
control_coxph_annot | Control functions for Kaplan-Meier plot annotation tables
control_coxreg | Control function for Cox regression
control_incidence_rate | Control function for incidence rate
control_lineplot_vars | Control function for 'g_lineplot()'
control_logistic | Control function for logistic regression model fitting
control_riskdiff | Control function for risk difference column
control_step | Control function for subgroup treatment effect pattern (STEP) calculations
control_surv_med_annot | Control functions for Kaplan-Meier plot annotation tables
control_surv_time | Control function for 'survfit' models for survival time
control_surv_timepoint | Control function for 'survfit' models for patients' survival rate at time points
count_occurrences | Count occurrences
count_occurrences_by_grade | Count occurrences by grade
count_patients_with_event | Count the number of patients with a particular event
count_patients_with_flags | Count the number of patients with particular flags
count_values | Count specific values
cox_regression | Cox proportional hazards regression
cox_regression_inter | Cox regression helper function for interactions
cut_quantile_bins | Cut numeric vector into empirical quantile bins

## -- D --

day2month | Conversion of days to months
decorate_grob | Add titles, footnotes, page Number, and a bounding box to a grid grob
decorate_grob_set | Decorate set of 'grob's and add page numbering
default_na_str | Default string replacement for 'NA' values
default_stats_formats_labels | Get default statistical methods and their associated formats, labels, and indent modifiers
df_explicit_na | Encode categorical missing values in a data frame
draw_grob | Draw 'grob'
d_count_abnormal_by_baseline | Description function for 's_count_abnormal_by_baseline()'
d_count_cumulative | Description of cumulative count
d_count_missed_doses | Description function that calculates labels for 's_count_missed_doses()'
d_onco_rsp_label | Description of standard oncology response
d_pkparam | Generate PK reference dataset
d_proportion | Description of the proportion summary
d_proportion_diff | Description of method used for proportion comparison
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

## -- E --

estimate_multinomial_response | Estimate proportions of each level of a variable
estimate_multinomial_rsp | Estimate proportions of each level of a variable
estimate_odds_ratio | Odds ratio estimation
estimate_proportion | Proportion estimation
estimate_proportion_diff | Proportion difference estimation
explicit_na | Missing data
extract_rsp_biomarkers | Prepare response data estimates for multiple biomarkers in a single data frame
extract_rsp_subgroups | Prepare response data for population subgroups in data frames
extract_survival_biomarkers | Prepare survival data estimates for multiple biomarkers in a single data frame
extract_survival_subgroups | Prepare survival data for population subgroups in data frames
extreme_format | Format extreme values
ex_data | Simulated CDISC data for examples

## -- F --

factor_utils | Factor utilities
fct_collapse_only | Factor utilities
fct_discard | Factor utilities
fct_explicit_na_if | Factor utilities
fit_coxreg | Fitting functions for Cox proportional hazards regression
fit_coxreg_multivar | Fitting functions for Cox proportional hazards regression
fit_coxreg_univar | Fitting functions for Cox proportional hazards regression
fit_logistic | Fit for logistic regression
fit_rsp_step | Subgroup treatment effect pattern (STEP) fit for binary (response) outcome
fit_survival_step | Subgroup treatment effect pattern (STEP) fit for survival outcome
forest_viewport | Create a viewport tree for the forest plot
formatting_functions | Formatting functions
format_auto | Format automatically using data significant digits
format_count_fraction | Format count and fraction
format_count_fraction_fixed_dp | Format count and percentage with fixed single decimal place
format_count_fraction_lt10 | Format count and fraction with special case for count < 10
format_extreme_values | Format a single extreme value
format_extreme_values_ci | Format extreme values part of a confidence interval
format_fraction | Format fraction and percentage
format_fraction_fixed_dp | Format fraction and percentage with fixed single decimal place
format_fraction_threshold | Format fraction with lower threshold
format_sigfig | Format numeric values by significant figures
format_xx | Format XX as a formatting function
f_conf_level | Utility function to create label for confidence interval
f_pval | Utility function to create label for p-value

## -- G --

get_formats_from_stats | Get default statistical methods and their associated formats, labels, and indent modifiers
get_indents_from_stats | Get default statistical methods and their associated formats, labels, and indent modifiers
get_labels_from_stats | Get default statistical methods and their associated formats, labels, and indent modifiers
get_smooths | Smooth function with optional grouping
get_stats | Get default statistical methods and their associated formats, labels, and indent modifiers
get_stat_names | Get default statistical methods and their associated formats, labels, and indent modifiers
groups_list_to_df | Convert list of groups to a data frame
g_bland_altman | Bland-Altman plot
g_forest | Create a forest plot from an 'rtable'
g_ipp | Individual patient plots
g_km | Kaplan-Meier plot
g_lineplot | Line plot with optional table
g_step | Create a STEP graph
g_waterfall | Horizontal waterfall plot

## -- H --

has_counts_difference | Occurrence table pruning
has_count_in_any_col | Occurrence table pruning
has_count_in_cols | Occurrence table pruning
has_fractions_difference | Occurrence table pruning
has_fraction_in_any_col | Occurrence table pruning
has_fraction_in_cols | Occurrence table pruning
h_adlb_abnormal_by_worst_grade | Helper function to prepare ADLB for 'count_abnormal_by_worst_grade()'
h_adlb_worsen | Helper function to prepare ADLB with worst labs
h_adsl_adlb_merge_using_worst_flag | Helper function for deriving analysis datasets for select laboratory tables
h_ancova | Helper function to return results of a linear model
h_append_grade_groups | Helper function for 's_count_occurrences_by_grade()'
h_biomarkers_subgroups | Helper functions for tabulation of a single biomarker result
h_col_indices | Obtain column indices
h_count_cumulative | Helper function for 's_count_cumulative()'
h_coxph_df | Helper functions for tabulating survival duration by subgroup
h_coxph_subgroups_df | Helper functions for tabulating survival duration by subgroup
h_coxreg_extract_interaction | Cox regression helper function for interactions
h_coxreg_inter_effect | Cox regression helper function for interactions
h_coxreg_inter_effect.character | Cox regression helper function for interactions
h_coxreg_inter_effect.factor | Cox regression helper function for interactions
h_coxreg_inter_effect.numeric | Cox regression helper function for interactions
h_coxreg_inter_estimations | Cox regression helper function for interactions
h_coxreg_multivar_extract | Helper functions for Cox proportional hazards regression
h_coxreg_multivar_formula | Helper functions for Cox proportional hazards regression
h_coxreg_mult_cont_df | Helper functions for tabulating biomarker effects on survival by subgroup
h_coxreg_univar_extract | Helper functions for Cox proportional hazards regression
h_coxreg_univar_formulas | Helper functions for Cox proportional hazards regression
h_cox_regression | Helper functions for Cox proportional hazards regression
h_data_plot | Helper function to tidy survival fit data
h_decompose_gg | 'ggplot' decomposition
h_format_row | Helper function to format the optional 'g_lineplot' table
h_format_threshold | Format extreme values
h_get_format_threshold | Format extreme values
h_get_interaction_vars | Helper functions for multivariate logistic regression
h_ggkm | Helper function to create a KM plot
h_glm_interaction_extract | Helper functions for multivariate logistic regression
h_glm_inter_term_extract | Helper functions for multivariate logistic regression
h_glm_simple_term_extract | Helper functions for multivariate logistic regression
h_grob_coxph | Helper function to create Cox-PH grobs
h_grob_median_surv | Helper function to create survival estimation grobs
h_grob_tbl_at_risk | Helper function to create patient-at-risk grobs
h_grob_y_annot | Helper function to create grid object with y-axis annotation
h_g_ipp | Helper function to create simple line plot over time
h_interaction_coef_name | Helper functions for multivariate logistic regression
h_interaction_term_labels | Helper functions for multivariate logistic regression
h_km_layout | Helper function to prepare a KM layout
h_logistic_inter_terms | Helper functions for multivariate logistic regression
h_logistic_mult_cont_df | Helper functions for tabulating biomarker effects on binary response by subgroup
h_logistic_regression | Helper functions for multivariate logistic regression
h_logistic_simple_terms | Helper functions for multivariate logistic regression
h_map_for_count_abnormal | Helper function to create a map data frame for 'trim_levels_to_map()'
h_odds_ratio | Helper functions for odds ratio estimation
h_odds_ratio_df | Helper functions for tabulating binary response by subgroup
h_odds_ratio_subgroups_df | Helper functions for tabulating binary response by subgroup
h_or_cat_interaction | Helper functions for multivariate logistic regression
h_or_cont_interaction | Helper functions for multivariate logistic regression
h_or_interaction | Helper functions for multivariate logistic regression
h_pkparam_sort | Sort pharmacokinetic data by 'PARAM' variable
h_ppmeans | Function to return the estimated means using predicted probabilities
h_proportions | Helper functions for calculating proportion confidence intervals
h_proportion_df | Helper functions for tabulating binary response by subgroup
h_proportion_subgroups_df | Helper functions for tabulating binary response by subgroup
h_prop_diff | Helper functions to calculate proportion difference
h_response_biomarkers_subgroups | Helper functions for tabulating biomarker effects on binary response by subgroup
h_response_subgroups | Helper functions for tabulating binary response by subgroup
h_rsp_to_logistic_variables | Helper functions for tabulating biomarker effects on binary response by subgroup
h_simple_term_labels | Helper functions for multivariate logistic regression
h_split_by_subgroups | Split data frame 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 | Helper functions for subgroup treatment effect pattern (STEP) calculations
h_step_rsp_est | Helper functions for subgroup treatment effect pattern (STEP) calculations
h_step_rsp_formula | Helper functions for subgroup treatment effect pattern (STEP) calculations
h_step_survival_est | Helper functions for subgroup treatment effect pattern (STEP) calculations
h_step_survival_formula | Helper functions for subgroup treatment effect pattern (STEP) calculations
h_step_trt_effect | Helper functions for subgroup treatment effect pattern (STEP) calculations
h_step_window | Helper functions for subgroup treatment effect pattern (STEP) calculations
h_survival_biomarkers_subgroups | Helper functions for tabulating biomarker effects on survival by subgroup
h_survival_duration_subgroups | Helper functions for tabulating survival duration by subgroup
h_survtime_df | Helper functions for tabulating survival duration by subgroup
h_survtime_subgroups_df | Helper functions for tabulating survival duration by subgroup
h_surv_to_coxreg_variables | Helper functions for tabulating biomarker effects on survival by subgroup
h_tab_one_biomarker | Helper functions for tabulation of a single biomarker result
h_tab_rsp_one_biomarker | Helper functions for tabulation of a single biomarker result
h_tab_surv_one_biomarker | Helper functions for tabulation of a single biomarker result
h_tbl_coxph_pairwise | Helper function for generating a pairwise Cox-PH table
h_tbl_median_surv | Helper function for survival estimations
h_worsen_counter | Helper function to analyze patients for 's_count_abnormal_lab_worsen_by_baseline()'
h_xticks | Helper function to calculate x-tick positions

## -- I --

imputation_rule | Apply 1/3 or 1/2 imputation rule to data
individual_patient_plot | Individual patient plots

## -- K --

kaplan_meier | Kaplan-Meier plot
keep_content_rows | Occurrence table pruning
keep_rows | Occurrence table pruning

## -- L --

labels_use_control | Update labels according to control specifications
level_order | Custom split functions
logistic_regression_cols | Logistic regression multivariate column layout function
logistic_summary_by_flag | Logistic regression summary table

## -- M --

month2day | Conversion of months to days

## -- O --

odds_ratio | Odds ratio estimation
or_clogit | Helper functions for odds ratio estimation
or_glm | Helper functions for odds ratio estimation

## -- P --

prop_agresti_coull | Helper functions for calculating proportion confidence intervals
prop_clopper_pearson | Helper functions for calculating proportion confidence intervals
prop_diff | Proportion difference estimation
prop_diff_cmh | Helper functions to calculate proportion difference
prop_diff_ha | Helper functions to calculate proportion difference
prop_diff_nc | Helper functions to calculate proportion difference
prop_diff_strat_nc | Helper functions to calculate proportion difference
prop_diff_wald | Helper functions to calculate proportion difference
prop_jeffreys | Helper functions for calculating proportion confidence intervals
prop_strat_wilson | Helper functions for calculating proportion confidence intervals
prop_wald | Helper functions for calculating proportion confidence intervals
prop_wilson | Helper functions for calculating proportion confidence intervals
prune_occurrences | Occurrence table pruning

## -- R --

reapply_varlabels | Reapply variable labels
ref_group_position | Custom split functions
response_biomarkers_subgroups | Tabulate biomarker effects on binary response by subgroup
rtable2gg | Convert 'rtable' objects to 'ggplot' objects

## -- S --

sas_na | Convert strings to 'NA'
score_occurrences | Occurrence table sorting
score_occurrences_cols | Occurrence table sorting
score_occurrences_cont_cols | Occurrence table sorting
score_occurrences_subtable | Occurrence table sorting
set_default_na_str | Default string replacement for 'NA' values
split_cols_by_groups | Split columns by groups of levels
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
stat_propdiff_ci | Proportion difference and confidence interval
strata_normal_quantile | Helper function for the estimation of stratified quantiles
summarize_colvars | Summarize variables in columns
summarize_coxreg | Cox proportional hazards regression
summarize_functions | Summarize functions
summarize_logistic | Multivariate logistic regression table
summarize_occurrences | Count occurrences
summarize_occurrences_by_grade | Count occurrences by grade
summary_formats | Get default statistical methods and their associated formats, labels, and indent modifiers
summary_labels | Get default statistical methods and their associated formats, labels, and indent modifiers
survival_biomarkers_subgroups | Tabulate biomarker effects on survival by subgroup
s_bland_altman | Bland-Altman analysis
s_compare | Compare variables between groups
s_compare.character | Compare variables between groups
s_compare.factor | Compare variables between groups
s_compare.logical | Compare variables between groups
s_compare.numeric | Compare variables between groups
s_count_occurrences | Count occurrences
s_count_occurrences_by_grade | Count occurrences by grade
s_count_patients_with_event | Count the number of patients with a particular event
s_count_patients_with_flags | Count the number of patients with particular flags
s_count_values | Count specific values
s_count_values.character | Count specific values
s_count_values.factor | Count specific values
s_count_values.logical | Count specific values
s_coxreg | Cox proportional hazards regression
s_length_proportion | Estimate proportions of each level of a variable
s_odds_ratio | Odds ratio estimation
s_proportion | Proportion estimation
s_proportion_diff | Proportion difference estimation
s_summary | Analyze variables
s_summary.character | Analyze variables
s_summary.factor | Analyze variables
s_summary.logical | Analyze variables
s_summary.numeric | Analyze variables

## -- T --

tabulate_rsp_biomarkers | Tabulate biomarker effects on binary response by subgroup
tabulate_survival_biomarkers | Tabulate biomarker effects on survival by subgroup
tern | tern Package
tern_default_formats | Get default statistical methods and their associated formats, labels, and indent modifiers
tern_default_labels | Get default statistical methods and their associated formats, labels, and indent modifiers
tern_default_stats | Get default statistical methods and their associated formats, labels, and indent modifiers
tern_ex_adae | Simulated CDISC data for examples
tern_ex_adlb | Simulated CDISC data for examples
tern_ex_adpp | Simulated CDISC data for examples
tern_ex_adrs | Simulated CDISC data for examples
tern_ex_adsl | Simulated CDISC data for examples
tern_ex_adtte | Simulated CDISC data for examples
tidy.coxreg.multivar | Custom tidy methods for Cox regression
tidy.coxreg.univar | Custom tidy methods for Cox regression
tidy.glm | Custom tidy method for binomial GLM results
tidy.step | Custom tidy method for STEP results
tidy.summary.coxph | Custom tidy methods for Cox regression
tidy_coxreg | Custom tidy methods for Cox regression
to_n | Replicate entries of a vector if required
to_string_matrix | Convert table into matrix of strings

## -- U --

univariate | Univariate formula special term
update_weights_strat_wilson | Helper function for the estimation of weights for 'prop_strat_wilson()'
utils_split_funs | Custom split functions

## -- misc --

!-method | Class for 'CombinationFunction'
&-method | Class for 'CombinationFunction'
|-method | Class for 'CombinationFunction'