diff --git a/main/404.html b/main/404.html index 6a5947dd3e..54961ad763 100644 --- a/main/404.html +++ b/main/404.html @@ -1,5 +1,4 @@ - - +
@@ -58,7 +57,38 @@We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our community include:
-Examples of unacceptable behavior include:
-Examples of unacceptable behavior include:
+Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
Community Impact: A violation through a single incident or series of actions.
Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
Consequence: A permanent ban from any sort of public interaction within the community.
This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
Community Impact Guidelines were inspired by Mozilla’s code of conduct enforcement ladder.
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
@@ -114,17 +190,19 @@🙏 Thank you for taking the time to contribute!
Your input is deeply valued, whether an issue, a pull request, or even feedback, regardless of size, content or scope.
Please refer the project documentation for a brief introduction. Please also see other articles within the project documentation for additional information.
A Code of Conduct governs this project. Participants and contributors are expected to follow the rules outlined therein.
We use GitHub to track issues, feature requests, and bugs. Before submitting a new issue, please check if the issue has already been reported. If the issue already exists, please upvote the existing issue 👍.
For new feature requests, please elaborate on the context and the benefit the feature will have for users, developers, or other relevant personas.
This repository uses the GitHub Flow model for collaboration. To submit a pull request:
-Create a branch
Please see the branch naming convention below. If you don’t have write access to this repository, please fork it.
Make changes
Make sure your code
-Create a pull request (PR)
In the pull request description, please link the relevant issue (if any), provide a detailed description of the change, and include any assumptions.
@@ -106,76 +177,93 @@Suppose your changes are related to a current issue in the current project; please name your branch as follows: <issue_id>_<short_description>
. Please use underscore (_
) as a delimiter for word separation. For example, 420_fix_ui_bug
would be a suitable branch name if your change is resolving and UI-related bug reported in issue number 420
in the current project.
If your change affects multiple repositories, please name your branches as follows: <issue_id>_<issue_repo>_<short description>
. For example, 69_awesomeproject_fix_spelling_error
would reference issue 69
reported in project awesomeproject
and aims to resolve one or more spelling errors in multiple (likely related) repositories.
monorepo
and staged.dependencies
-Sometimes you might need to change upstream dependent package(s) to be able to submit a meaningful change. We are using staged.dependencies
functionality to simulate a monorepo
behavior. The dependency configuration is already specified in this project’s staged_dependencies.yaml
file. You need to name the feature branches appropriately. This is the only exception from the branch naming convention described above.
Please refer to the staged.dependencies package documentation for more details.
This repository follows some unified processes and standards adopted by its maintainers to ensure software development is carried out consistently within teams and cohesively across other repositories.
This repository follows the standard tidyverse
style guide and uses lintr
for lint checks. Customized lint configurations are available in this repository’s .lintr
file.
Lightweight is the right weight. This repository follows tinyverse recommedations of limiting dependencies to minimum.
If the code is not compatible with all (!) historical versions of a given dependenct package, it is required to specify minimal version in the DESCRIPTION
file. In particular: if the development version requires (imports) the development version of another package - it is required to put abc (>= 1.2.3.9000)
.
We continuously test our packages against the newest R version along with the most recent dependencies from CRAN and BioConductor. We recommend that your working environment is also set up in the same way. You can find the details about the R version and packages used in the R CMD check
GitHub Action execution log - there is a step that prints out the R sessionInfo()
.
If you discover bugs on older R versions or with an older set of dependencies, please create the relevant bug reports.
pre-commit
pre-commit
+We highly recommend that you use the pre-commit
tool combined with R hooks for pre-commit
to execute some of the checks before committing and pushing your changes.
Pre-commit hooks are already available in this repository’s .pre-commit-config.yaml
file.
As mentioned previously, all contributions are deeply valued and appreciated. While all contribution data is available as part of the repository insights, to recognize a significant contribution and hence add the contributor to the package authors list, the following rules are enforced:
-git blame
query) ORgit blame
query) OR*Excluding auto-generated code, including but not limited to roxygen
comments or renv.lock
files.
*Excluding auto-generated code, including but not limited to roxygen
comments or renv.lock
files.
The package maintainer also reserves the right to adjust the criteria to recognize contributions.
If you have further questions regarding the contribution guidelines, please contact the package/repository maintainer.
If you believe you have found a security vulnerability in any of the repositories in this organization, please report it to us through coordinated disclosure.
Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.
Instead, please send an email to vulnerability.management[@]roche.com.
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
-This information will help us triage your report more quickly.
+This information will help us triage your report more quickly.
Joe Zhu. Author, maintainer.
F. Hoffmann-La Roche AG. Copyright holder, funder.
denom
parameter to s_count_cumulative()
, s_count_missed_doses()
, and s_count_occurrences_by_grade()
.denom
parameter to s_count_cumulative()
, s_count_missed_doses()
, and s_count_occurrences_by_grade()
."N_row"
as an optional input to denom
in s_count_occurrences()
.a_count_occurrences_by_grade()
, a_count_patients_with_event()
, and a_count_patients_with_flags()
to no longer use make_afun()
.rel_height_plot
parameter to g_lineplot()
to control the line plot height relative to annotation table height.summarize_change()
to work without make_afun()
and access all additional function parameter.tern
functions” for future reference.a_summary()
causing non-unique row_name
values to occur when multiple statistics are selected for count variables.a_summary()
causing non-unique row_name
values to occur when multiple statistics are selected for count variables.summary_formats()
and summary_labels()
. Added disclaimer about underlying use of get_stats
.summary_formats()
and summary_labels()
. Added disclaimer about underlying use of get_stats
.NA
for summarize_change()
.CRAN release: 2024-09-24
-median_ci_3d
to s_summary
which includes estimate and confidence interval in one statistic.CRAN release: 2024-09-24
+median_ci_3d
to s_summary
which includes estimate and confidence interval in one statistic.median_ci_3d
, quantiles_lower
and quantiles_upper
to s_surv_time
which includes estimate and confidence interval in one statistic.hr_ci_3d
to s_coxph_pairwise
which includes estimate and confidence interval in one statistic.event_free_rate_3d
to s_surv_timepoint
which includes estimate and confidence interval in one statistic.fraction
statistic to the analyze_var_count
method group.
summarize_glm_count()
documentation and all its associated functions to better describe the results and the functions’ purpose.method
argument to s_odds_ratio()
and estimate_odds_ratio()
to control whether exact or approximate conditional likelihood calculations are used.d_count_cumulative
parameters as described in the documentation.d_count_cumulative
parameters as described in the documentation.g_lineplot
x-axis were not shown in either plots.a_surv_time
that threw an error when split only has "is_event"
.g_lineplot
when using only one group or strata level.summary_formats
and summary_labels
.summary_formats
and summary_labels
.strata
and cohort_id
arguments to g_lineplot
.h_incidence_rate.R
file.CRAN release: 2024-06-21
-facet_var
to g_lineplot
to allow plot faceting by a factor variable.CRAN release: 2024-06-21
+facet_var
to g_lineplot
to allow plot faceting by a factor variable.label_all
parameter to extract_survival_biomarkers
and extract_survival_subgroups
.xticks
, xlim
, and ylim
arguments to g_lineplot
to allow for customization of the x and y axes.g_lineplot
legend to follow factor levels set by users.s_ancova
that prevented statistics from being printed when arm levels include special characters.s_ancova
that prevented statistics from being printed when arm levels include special characters.decorate_grob
that prevented the right margins to be respected when adding title and footers decorations.label_all
parameter to tabulate_survival_biomarkers
and tabulate_survival_subgroups
, with redirection to the same parameter in their associated extract_*
functions.label_all
parameter to tabulate_survival_biomarkers
and tabulate_survival_subgroups
, with redirection to the same parameter in their associated extract_*
functions.CRAN release: 2024-04-17
-h_glm_negbin
to h_glm_count
to enable count data analysis using a negative binomial model.CRAN release: 2024-04-17
+h_glm_negbin
to h_glm_count
to enable count data analysis using a negative binomial model.grade_groups_only
to count_occurrences_by_grade
to allow users to only display rows for specified grade groups.df2gg
that converts data.frame
objects to ggplot
objects.control_surv_med_annot
and control_coxph_annot
to configure g_km
annotation table sizes/positions.g_km
to output a ggplot
object instead of a grob
object.g_forest
to output a ggplot
object instead of a grob
object.mean_pval
) updated from "xx.xx"
to "x.xxxx | (<0.0001)"
.mean_pval
) updated from "xx.xx"
to "x.xxxx | (<0.0001)"
.rtable2gg
to clean up appearance of text labels.rtable2gg
to clean up appearance of text labels.s_ancova
causing incorrect difference calculations for arm variables with irregular levels.format_count_fraction_fixed_dp
that did not have the same print when the fraction was 1 (100%).g_lineplot
causing default labels not to update according to specified control
settings.NA
values.expect_snapshot_ggplot
to test setup file to process plot snapshot tests and allow plot dimensions to be set.expect_snapshot_ggplot
to test setup file to process plot snapshot tests and allow plot dimensions to be set.ggplot2
3.5.0.individual_patient_plot.R
to g_ipp.R
.time_unit_input
, time_unit_output
, na_level
and indent_mod
.forest_grob
, forest_dot_line
, forest_viewport
, vp_forest_table_part
, and grid.forest
functions.
h_ggkm
, h_decompose_gg
, h_km_layout
, h_grob_tbl_at_risk
, h_grob_median_surv
, h_grob_y_annot
, and h_grob_coxph
.grob
/grid
related functions stack_grobs
, arrange_grobs
, and draw_grob
which are no longer used in tern
.CRAN release: 2023-12-08
-ref_group_position
function to place the reference group facet last, first or at a certain position.CRAN release: 2023-12-08
+ref_group_position
function to place the reference group facet last, first or at a certain position.keep_level_order
split function to retain original order of levels in a split.level_order
split function to reorder manually the levels.get_indents_from_stats
to format and return indent modifiers for a given set of statistics.s_bland_altman
function to assess agreement between two numerical vectors.
rtable2gg
that converts rtable
objects to ggplot
objects.na_str
globally with set_default_na_str()
and added default_na_str()
for all interested functions.ref_group_coxph
parameter to g_km
to specify the reference group used for pairwise Cox-PH calculations when annot_coxph = TRUE
.ref_group_coxph
parameter to g_km
to specify the reference group used for pairwise Cox-PH calculations when annot_coxph = TRUE
.annot_coxph_ref_lbls
parameter to g_km
to enable printing the reference group in table labels when annot_coxph = TRUE
.x_lab
parameter to g_lineplot
to customize x-axis label.g_lineplot
.arm_y
argument.count_by
input in analyze_num_patients
and summarize_num_patients
.g_lineplot
.na_str
argument to analyze
& summarize_row_groups
wrapper functions count_abnormal
, count_abnormal_by_baseline
, count_abnormal_by_marked
, count_abnormal_by_worst_grade
, count_abnormal_lab_worsen_by_baseline
, count_cumulative
, count_missed_doses
, count_occurrences
, count_occurrences_by_grade
, summarize_occurrences_by_grade
, summarize_patients_events_in_cols
, count_patients_with_event
, count_patients_with_flags
, count_values
, estimate_multinomial_response
, estimate_proportion
, h_tab_one_biomarker
, estimate_incidence_rate
, logistic_summary_by_flag
, estimate_odds_ratio
, estimate_proportion_diff
, test_proportion_diff
, summarize_ancova
, summarize_change
, summarize_glm_count
, summarize_num_patients
, analyze_num_patients
, summarize_patients_exposure_in_cols
, coxph_pairwise
, tabulate_survival_subgroups
, surv_time
, and surv_timepoint
.na_str
argument to analyze
& summarize_row_groups
wrapper functions count_abnormal
, count_abnormal_by_baseline
, count_abnormal_by_marked
, count_abnormal_by_worst_grade
, count_abnormal_lab_worsen_by_baseline
, count_cumulative
, count_missed_doses
, count_occurrences
, count_occurrences_by_grade
, summarize_occurrences_by_grade
, summarize_patients_events_in_cols
, count_patients_with_event
, count_patients_with_flags
, count_values
, estimate_multinomial_response
, estimate_proportion
, h_tab_one_biomarker
, estimate_incidence_rate
, logistic_summary_by_flag
, estimate_odds_ratio
, estimate_proportion_diff
, test_proportion_diff
, summarize_ancova
, summarize_change
, summarize_glm_count
, summarize_num_patients
, analyze_num_patients
, summarize_patients_exposure_in_cols
, coxph_pairwise
, tabulate_survival_subgroups
, surv_time
, and surv_timepoint
.format_count_fraction_lt10
for formatting count_fraction
with special consideration when count is less than 10.format_count_fraction_lt10
for formatting count_fraction
with special consideration when count is less than 10.s_summary.logical
output for count_fraction
when denominator is zero to display as NA
instead of 0
in tables.analyze_vars_in_cols
to allow character input to indicate whether nominal time point is post-dose or pre-dose when applying the 1/3 imputation rule.g_km
causing an error when converting certain annotation width units.na_level
argument in s_count_abnormal_by_baseline
, a_summary
, analyze_vars
, analyze_vars_in_cols
, compare_vars
, h_map_for_count_abnormal
, h_stack_by_baskets
, summarize_colvars
, a_coxreg
, and summarize_coxreg
and replaced it with the na_str
argument.na_level
argument in s_count_abnormal_by_baseline
, a_summary
, analyze_vars
, analyze_vars_in_cols
, compare_vars
, h_map_for_count_abnormal
, h_stack_by_baskets
, summarize_colvars
, a_coxreg
, and summarize_coxreg
and replaced it with the na_str
argument.strata
and cohort_id
parameters renamed to group_var
and subject_var
respectively in g_lineplot
and control_lineplot_vars
.imputation_rule
function to apply imputation rule to data.imputation_rule
function to apply imputation rule to data.format_sigfig
to allow for numeric value formatting by a specified number of significant figures.tern_default_formats
and tern_default_labels
, respectively.get_stats
to return methods from given statistical method groups.get_formats_from_stats
to return formats and get_labels_from_stats
to return labels for a given set of statistics."auto"
option for .formats
. It uses format_auto
to determine automatically the number of digits.title
argument to h_grob_tbl_at_risk
and annot_at_risk_title
argument to g_km
and h_km_layout
which allows user to add “Patients at Risk” title to Kaplan-Meier at risk annotation table.tabulate_rsp_subgroups
to pass sanitation checks by preventing creation of degenerate subtables.tabulate_rsp_subgroups
to pass sanitation checks by preventing creation of degenerate subtables.analyze_vars_in_cols
to use caching, allow implementation of imputation rule via the imp_rule
argument, and allow user to specify cell alignment via the .aligns
argument.add_rowcounts
to allow addition of row counts from alt_counts_df
using the alt_counts
argument.gp
argument to g_forest
to control graphical parameters such as font size.utils_defaults_handling.R
.utils_defaults_handling.R
.summary_custom()
and a_summary()
as a S3
method.p-value
in the discrete case to pval_counts
.a_summary_internal()
in favor of only one main a_summary()
.CRAN release: 2023-09-01
-stat_propdiff_ci
function to calculate proportion/risk difference and CI.CRAN release: 2023-09-01
+stat_propdiff_ci
function to calculate proportion/risk difference and CI.riskdiff
argument to functions count_occurrences
, count_occurrences_by_grade
, count_patients_with_event
, count_patients_with_flags
, analyze_num_patients
, and summarize_num_patients
.a_summary
to no longer use the helper function create_afun_summary
.a_summary
to no longer use the helper function create_afun_summary
.summarize_vars
and compare_vars
to use the refactored a_summary
function.ungroup_stats
to ungroup statistics calculated for factor variables, and a_summary_internal
to perform calculations for a_summary
.s_count_occurrences_by_grade
so that “missing” grade always appears as the final level.s_count_occurrences_by_grade
so that “missing” grade always appears as the final level.analyze_vars_in_cols
when categorical data was used.s_count_occurrences_by_grade
so that levels are not relabeled when reordering to account for “missing” grades..N_row
and .N_col
parameters..N_row
and .N_col
parameters.df_explicit_na
. Changes in NA
values should happen externally to tern
functions, depending on users’ needs.create_afun_summary
and create_afun_compare
.ylim
argument to g_km
to allow the user to set custom limits for the y-axis.ylim
argument to g_km
to allow the user to set custom limits for the y-axis.g_km
which checks whether there is one arm present in the data when annot_coxph
is true.flag_labels
argument to s_count_patients_with_flags
to enable more label handling options in count_patients_by_flags
.nested
argument to analyze
wrapper functions count_abnormal
, count_abnormal_by_baseline
, count_abnormal_by_marked
, count_abnormal_by_worst_grade
, count_abnormal_lab_worsen_by_baseline
, count_cumulative
, count_missed_doses
, count_occurrences
, count_occurrences_by_grade
, count_patients_with_event
, count_patients_with_flags
, count_values
, estimate_multinomial_response
, estimate_proportion
, estimate_incidence_rate
, estimate_odds_ratio
, estimate_proportion_diff
, test_proportion_diff
, summarize_ancova
, summarize_change
, summarize_glm_count
, analyze_num_patients
, coxph_pairwise
, surv_time
, and surv_timepoint
.summarize_vars
and control_summarize_vars
. Renamed into analyze_vars
and control_analyze_vars
to reflect underlying rtables
machinery while keeping backward compatibility with aliases.summarize_vars
and control_summarize_vars
. Renamed into analyze_vars
and control_analyze_vars
to reflect underlying rtables
machinery while keeping backward compatibility with aliases.CRAN release: 2023-06-27
-character
class to h_coxreg_inter_effect
enabling character
covariates in summarize_coxreg
.CRAN release: 2023-06-27
+character
class to h_coxreg_inter_effect
enabling character
covariates in summarize_coxreg
.time_unit_input
and time_unit_output
arguments and replaced them with the input_time_unit
and num_pt_year
, respectively, in control_incidence_rate
.time_unit_input
and time_unit_output
arguments and replaced them with the input_time_unit
and num_pt_year
, respectively, in control_incidence_rate
.pairwise
function.a_compare
and replaced it with a_summary
with argument compare = TRUE
.create_afun_summary
and create_afun_compare
which are no longer used by a_summary
and a_compare
respectively.sum(weights)
for M1mac
installation.CRAN release: 2023-06-19
-g_km
plot “at risk” annotation tables.CRAN release: 2023-06-19
+g_km
plot “at risk” annotation tables.analyze_patients_exposure_in_cols
..indent_mods
argument in functions h_tab_one_biomarker
, h_tab_rsp_one_biomarker
, h_tab_surv_one_biomarker
, summarize_logistic
, logistic_summary_by_flag
, tabulate_rsp_biomarkers
, a_coxreg
, summarize_coxreg
, tabulate_survival_biomarkers
, surv_time
, surv_timepoint
, and cfun_by_flag
.summarize_coxreg
to print covariates in data rows for univariate Cox regression with no interactions and content rows otherwise.d_count_abnormal_by_baseline
labels.g_km
and added dynamic scaling of the surv_med
and coxph
annotation tables, with customization via the width_annots
argument.split_text_grob
preventing titles and footnotes from being properly formatted and printed by decorate_grob
.split_text_grob
preventing titles and footnotes from being properly formatted and printed by decorate_grob
.g_lineplot
preventing the addition of lines to the plot when midpoint statistic calculations result in NA
value(s).tern:::tidy.glm
formals to respect broom:::tidy.default
formals.README
to include installation instructions for CRAN.README
to include installation instructions for CRAN.has_count_in_cols
, has_counts_difference
, combine_counts
, h_tab_rsp_one_biomarker
, arrange_grobs
, a_count_patients_sum_exposure
, a_coxreg
, groups_list_to_df
, forest_viewport
.README
to include installation instructions for CRAN.indent_mod
argument and replaced it with the .indent_mods
argument in summarize_num_patients
and analyze_num_patients
.s_coxreg
and summarize_coxreg
to work with new analysis function a_coxreg
.s_coxreg
and summarize_coxreg
to work with new analysis function a_coxreg
.section_div
and na_level
arguments to summarize_vars
.section_div
and na_level
arguments to summarize_vars
.median_range
as a numeric variable statistic option for summarize_vars
.d_onco_rsp_label
.s_proportion_diff
.
s_summary
and s_compare
to allow NA
values in input variables. For factor variables with NA
s, if na.rm = FALSE
an explicit NA
level will be automatically added. na.rm = TRUE
will also consider "<Missing>"
values and exclude them.na_level
parameter in s_summary
and s_compare
to align with other tern
functions. Instead of being a string to consider as NA
when setting na.rm = TRUE
, it now defines a string to print in place of NA
values in the output table.lubridate
package for date variables in tern
datasets.lubridate
package for date variables in tern
datasets..gitignore
and .Rbuildignore
files.footnotes
functions and all related files.pairwise
function.count_patients_with_flags
functions from count_patients_with_event.R
to count_patients_with_flags.R
.summarize_glm_count
function to analyze count data using a linear model.summarize_glm_count
function to analyze count data using a linear model.g_step
.format_fraction_fixed_dp
and format_count_fraction_fixed_dp
with fixed single decimal place in percentages.na_level
and labelstr
arguments to summarize_vars_in_cols
.h_row_first_values
function as a more general helper function to retrieve first values from specific rows.
"(n)"
suffix from unique_count
labels for s_num_patients
.g_km
to annotate with statistics (annot_stats
) and add corresponding vertical lines (annot_stats_lines
).s_count_occurrences_by_grade
.s_count_occurrences_by_grade
.summarize_vars_in_cols
to work with pagination machinery.conf_level
argument to emmeans::contrast()
in s_ancova
.rtables_access.R
caused by not checking for specific combinations (also the standard values that were never used) of column indices and names.pkgdown
reference..R
files for logistic regression and cox regression helper functions.analyze_num_patients
to generate an initial summary so there is no repetition when paginating.data/
folder and generated cached synthetic datasets.
data/
folder instead of scda
datasets.tern
. These tests are in internal repo scda.test
.summarize_vars_in_cols
to analyze_vars_in_cols
to reflect the appropriate analyze
logic.summarize_vars_in_cols
to analyze_vars_in_cols
to reflect the appropriate analyze
logic.summary_in_cols
helper functions.format_xx
.ggplot2
functions/arguments to fix warnings.forcats::fct_explicit_na
with forcats::fct_na_value_to_level
.wrap_text
function and related files.footnotes
functions.estimate_proportion
and estimate_proportion_diff
with relative tests.estimate_proportion
and estimate_proportion_diff
with relative tests.stat_mean_pval
, a new summary statistic to calculate the p-value of the mean.mean_se
(mean with standard error) for summarize_variables
and related functions.Rdpack
for references.DescTools::BinomDiffCI
function within tern
.summarize_logistic
to specify which pivoted value to use during analysis.s_coxph_pairwise
to generate log-rank p-value using original log-rank test instead of Cox Proportional-Hazards Model.nestcolor
in all examples by adapting g_km
, g_ipp
, g_waterfall
, g_step
, g_lineplot
, and g_forest
.interaction_y
and interaction_item
in ANCOVA to make the interaction calculations available.footnotes
to add footnotes to g_km
.assertthat
to checkmate
-checkmate::assert_vector
, checkmate::assert_set_equal
, and checkmate::assert_int
to check vector type, length, and values.checkmate::assert_vector
, checkmate::assert_set_equal
, and checkmate::assert_int
to check vector type, length, and values.checkmate
the following functions: all_elements_in_ref
, is_df_with_nlevels_factor
, is_df_with_no_na_level
, is_proportion_vector
, is_quantiles_vector
, is_character_or_factor
, is_nonnegative_count
, is_valid_character
, assert_character_or_factor
, assert_equal_length
and has_tabletree_colnames
.is_proportion
, is_equal_length
, is_df_with_no_na_level
, is_df_with_nlevels_factor
, is_variables
, is_df_with_variables
, is_df_with_factors
, is_valid_factor
to use assertion logic.as_factor_keep_attributes
.assert_df_with_factors
and assert_proportion_value
internal functions.assertthat.R
and test-assertthat.R
to utils_checkmate.R
and test-utils_checkmate.R
.count_abnormal_by_marked
(reference to abnormal_by_marked
), count_abnormal_lab_worsen_by_baseline
and h_adlb_worsen
(reference to abnormal_by_worst_grade_worsen_from_baseline
), count_abnormal_by_worst_grade
(reference to abnormal_by_worst_grade
), to_string_matrix
, tidy.summary.coxph
, tidy.step
, surv_timepoint
, (reference to survival_timepoint
), surv_time
(reference to survival_time
), coxph_pairwise
(reference to survival_coxph_pairwise
), extract_survival_subgroups
and tabulate_survival_subgroups
(reference to survival_duration_subgroups
), extract_survival_biomarkers
and tabulate_survival_biomarkers
(reference to survival_biomarkers_subgroups
), control_summarize_vars
, s_summary
and a_summary
(reference to summarize_variables
) and kept the S3 method tree.summarize_patients_exposure_in_cols
, summarize_num_patients
with s_num_patients
, s_num_patients_content
, summarize_num_patients
.control_coxreg
, control_coxph
, control_incidence_rate
, control_lineplot_vars
, control_surv_time
, control_surv_timepoint
, control_logisitic
, control_step
.stat_mean_ci
, stat_median_ci
, split_cols_by_groups
, explicit_na
, sas_na
, extract_rsp_subgroups
, tabulate_rsp_subgroups
, extract_rsp_biomarkers
, tabulate_rsp_biomarkers
, keep_rows
, keep_content_rows
, has_count_in_any_col
, has_fraction_in_cols
, has_fraction_in_any_col
, has_fractions_difference
, test_proportion_diff
, pairwise
, logistic_regression
, estimate_incidence_rate
, control_incidence_rate
(reference to incidence_rate
), cut_quantile_bins
, estimate_multinomial_rsp
, decorate_grob_set
, extreme_format
, fit_rsp_step
, fit_survival_step
, footnotes
, footnotes-set
, format_count_fraction
, format_fraction_threshold
, formatting_functions
, format_fraction
, combination_function
(S4 method), compare_variables
(S3 method), kaplan_meier
._pkgdown.yml
updated, and tern:::
added for tests/examples/vignettes where present for the following functions:
-abnormal_by_marked
) s_count_abnormal_by_marked
, a_count_abnormal_by_marked
.abnormal_by_marked
) s_count_abnormal_by_marked
, a_count_abnormal_by_marked
.abnormal_by_worst_grade_worsen_from_baseline
) a_count_abnormal_lab_worsen_by_baseline
, s_count_abnormal_lab_worsen_by_baseline
.abnormal_by_worst_grade
) s_count_abnormal_by_worst_grade
, a_count_abnormal_by_worst_grade
.survival_timepoint
) s_surv_timepoint
, s_surv_timepoint_diff
, a_surv_timepoint
, a_surv_timepoint_diff
.cox_regression_inter
, decorate_grob_factory
, draw_grob
, estimate_coef
.summary_labels
, summary_formats
, s_count_patients_sum_exposure
, a_change_from_baseline
s_change_from_baseline
, a_ancova
, s_ancova
, arrange_grobs
, as_factor_keep_attributes
, combine_levels
, split_text_grob
, groups_list_to_df
, s_cox_multivariate
, is_leaf_table
, a_response_subgroups
, range_noinf
, has_count_in_cols
, has_counts_difference
, prop_chisq
, prop_cmh
, prop_schouten
, prop_fisher
, s_test_proportion_diff
, a_test_proportion_diff
, fct_discard
, fct_explicit_na_if
.stats::ancova
output due to version inconsistency.stats::ancova
output due to version inconsistency.NA
coming from rtables
.formatters::var_labels
.prop_diff
functions to respect success responses (TRUE
values).g_mmrm
.g_mmrm
.tern:::
) and added dontrun
to internal function examples.color_palette
and h_set_nest_theme
in favor of nestcolor::color_palette
and nestcolor::theme_nest
, respectively.@md
and removed @order
from incidence_rate.R
. Modified examples accordingly.
prop_schouten
function documentation.draw_grob
function.@description
instead of every @descriptionIn
function. Corrected accordingly summarize_variables_in_cols
+@description
instead of every @descriptionIn
function. Corrected accordingly summarize_variables_in_cols
g_lineplot
, g_step
, g_waterfall
, cox_regression
, score_occurrences
, add_rowcounts
, odds_ratio
, count_occurrences
, count_occurrences_by_grade
, explicit_na
, df_explicit_na
, count_patients_with_event
, decorate_grob
, combine_groups
, append_varlabels
, univariate
, stack_grobs
, count_abnormal
(reference to abnormal
), count_abnormal_by_baseline
(reference to abnormal_by_baseline
)._pkgdown.yml
polished and tern:::
for tests, examples, and vignettes when present for the following functions:
-h_format_row
, h_map_for_count_abnormal
+h_format_row
, h_map_for_count_abnormal
make_names
, month2day
, day2month
empty_vector_if_na
, aesi_label
, n_available
, format_xx
, arm
.count_values_funs
, prop_difference
, combine_counts
.s_count_abnormal
, a_count_abnormal
.s_count_abnormal_by_baseline
, a_count_abnormal_by_baseline
, d_count_abnormal_by_baseline
.s_cox_univariate
function has now deprecated badge.g_lineplot
with table to automatically scale the table height and return a ggplot
object.g_lineplot
with table to automatically scale the table height and return a ggplot
object.g_ipp
with caption argument and adjust the position.prop_diff
, tern
function and related functions to be able to apply a continuity correction in the Newcombe method.summarize_numeric_in_columns
and summarize_variables
to allow factor/character summary and to be able to summarize the number of BLQs
in AVALC
from ADPC
dataset.sum
option to summarize_variables
.
stream
by default).h_pkparam_sort
function with argument key_var
to allow data with different column names.test-table_aet02.R
variant 12.test-table_aet02.R
variant 12.scda
data version to ‘2022-02-28’.pkgdown
site.grDevices
, stringr
, and viridisLite
.summarize_vars_numeric_in_cols
to summarize_vars_in_cols
.
g_lineplot
plot were not connected when missing values.h_pkparam_sort
to order PK PARAM
value based on the order of the dataset generated by d_pkparam()
.h_pkparam_sort
to order PK PARAM
value based on the order of the dataset generated by d_pkparam()
.d_pkparam
to generate PK parameter map for sorting.nudge_y
argument of h_g_ipp
to be dependent on the data, fixing an issue whereby the baseline labels were offset incorrectly.nudge_y
argument of h_g_ipp
to be dependent on the data, fixing an issue whereby the baseline labels were offset incorrectly.stat_mean_ci
and s_summary.numeric
to calculate the geometric mean with its confidence intervals.rtables
package refactor.rtables
package refactor.with_label
, var_labels
, and var_labels<-
to resolve conflict with the formatters
package, a new dependency.tern
” and “tern
tabulation” vignettes.h_map_for_count_abnormal
to create the map used in trim_levels_to_map
split function by calling this helper function. It supports two methods: one with all observed mapping, one with at least low limit above zero and at least one non missing high limit.h_map_for_count_abnormal
to create the map used in trim_levels_to_map
split function by calling this helper function. It supports two methods: one with all observed mapping, one with at least low limit above zero and at least one non missing high limit.s_summary_numeric_in_cols
and summarize_vars_numeric_in_cols
functions to generate summary statistics in columns, mainly used for PK datasets.s_summary.numeric
to use in s_summary_numeric_in_cols
.tabulate_survival_subgroups
and tabulate_rsp_subgroups
(Survival Duration and Best Response analyses) to calculate N
-s based on the records considered to create the model.tabulate_survival_subgroups
and tabulate_rsp_subgroups
(Survival Duration and Best Response analyses) to calculate N
-s based on the records considered to create the model.estimate_proportion
and related functions to be able to apply a continuity correction in the Wilson method.count_abnormal_by_marked
and related statistics and formatting functions to use a more efficient layout with .spl_context
argument used for determining denominators and with trim_levels_to_map
split function under split_rows_by
to show the desired levels in the table. This is a breaking change.count_abnormal_by_worst_grade
and related statistics and formatting functions to use a more efficient layout with .spl_context
argument used for determining denominators and with trim_levels_to_map
split function under split_rows_by
to show the desired levels in the table. This is a breaking change.count_abnormal
function and related statistics and formatting functions to use a more efficient layout with trim_levels_to_map
split function under split_rows_by
to show the desired levels in the table. Also updated abnormal
argument to be able to consider more than one level for each direction. This is a breaking change.estimate_incidence_rate
and related functions to consider the week as time unit for data input.assertthat
functions that output wrong data frame names and limited length of failure message outputs.assertthat
functions that output wrong data frame names and limited length of failure message outputs.utils.nest
by using the checkmate
and purrr
packages for validation and moved get_free_cores
and skip_if_too_deep
functions from utils.nest
into tern
.utils.nest
by using the checkmate
and purrr
packages for validation and moved get_free_cores
and skip_if_too_deep
functions from utils.nest
into tern
.survival_biomarkers_subgroups
and response_biomarkers_subgroups
.survival_biomarkers_subgroups
and response_biomarkers_subgroups
.g_lineplot
plot function, including new h_format_row
helper function and control_lineplot_vars
function. Removed g_summary_by
.h_stack_by_baskets
to stack events in SMQ and/or CQ basket flag in ADAE data set.s_summary.numeric
. Added names
attribute to each element of the final list returned by the s_summary.numeric
function. Added summary_formats
and summary_labels
helper functions.s_summary.numeric
. Added names
attribute to each element of the final list returned by the s_summary.numeric
function. Added summary_formats
and summary_labels
helper functions.df_explicit_na
.h_append_grade_groups
to improve its flexibility, robustness and clearness, and to make sure the result is ordering according to the order of grade_groups
. Also, added remove_single
argument which controls whether the elements of one-element grade groups are in the output or removed.var_labels
and show_labels
arguments to count_occurrences
and count_patients_with_flags
to allow for creation of a title row.na_level
argument to count_abnormal_by_baseline
.h_append_grade_groups
to no longer fill-in empty grade groups with zeros.prop_diff_cmh
to handle edge case of no FALSE (or TRUE) responses.prop_diff_cmh
to handle edge case of no FALSE (or TRUE) responses.g_mmrm_diagnostic
to improve error handling when data is not amenable to the Locally Weighted Scatterplot Smoothing.g_km
:
-arm
variable includes a single level and annot_coxph = TRUE
.day2month
and month2day
to work with NA data.day2month
and month2day
to work with NA data.stat_mean_ci
and stat_median_ci
so that they may return different outputs.h_row_counts
to handle analysis rows with NULL
cells.LICENCE
and README
with new package references.error_on_lint: TRUE
to .lintr
.arm
variable.arm
variable.cox_regression
to work without covariates. Also in case of interaction model summary, p-values for main effect coefficients are no longer displayed.summarize_vars
now include quantiles. summarize_vars
now accepts the control function control_summarize_vars
to specify details about confidence level for mean and median and quantile details. The control
argument replaces conf_level
.var_labels
and show_labels
arguments to count_occurrences_by_grade
.indent
argument in append_varlabels
to accept non-negative integer to represent the indent space defined by user. Previous calls with Boolean indent
will do an integer conversion and produce a warning.tabulate_survival_subgroups
and related survival forest plot functions to use total number of events, instead of observations, as default for scaling the symbol sizes in the plot. (The user might still use total number of observations manually if they wish to do so.)tabulate_survival_subgroups
and related survival forest plot functions to use total number of events, instead of observations, as default for scaling the symbol sizes in the plot. (The user might still use total number of observations manually if they wish to do so.)h_adsl_adlb_merge_using_worst_flag
will now impute BTOXGR
for missing visits.count_abnormal_by_worst_grade_by_baseline
and its related statistic and analysis functions as a simpler design will create lab abnormality tables.count_abnormal_by_worst_grade_by_baseline
and its related statistic and analysis functions as a simpler design will create lab abnormality tables.scda
instead of random.cdisc.data
package.fit_rsp_step
and fit_survival_step
, the corresponding tidy method tidy.step
as well as the graph function g_step
.fit_rsp_step
and fit_survival_step
, the corresponding tidy method tidy.step
as well as the graph function g_step
.compare_vars
which compares variables of different types between columns and produces a p-value for the comparison to the reference column. Function built on top of the summarize_vars
functionality.cut_quantile_bins
cuts a numeric vector into quantile bins.fct_collapse_only
collapses levels of a factor and keeps those in the order provided.range_noinf
is a kind of a wrapper function of base::range
. It returns c(NA, NA)
instead of c(-Inf, Inf)
for zero-length data.fit_coxreg_univar
and fit_coxreg_multivar
is now also possible without treatment arm. In the univariate case this means that it fits separate univariate models for the provided covariates and tabulation of corresponding effect estimates can later occur.fit_coxreg_univar
and fit_coxreg_multivar
is now also possible without treatment arm. In the univariate case this means that it fits separate univariate models for the provided covariates and tabulation of corresponding effect estimates can later occur.fraction
in result returned by s_count_occurrences
. It contains a list of numerators and denominators with one element per occurrence.sum_num_patients
and count_occurrences
for the result unique
and count_fraction
to return (0, 0) when input is empty.groups_lists
to extract_survival_subgroups
, extract_rsp_subgroups
and associated helper functions which allows to group factor levels of subgroup variables into manually defined groups, enhancing the flexibility of the resulting forest graphs.g_forest
now extracts default arguments from attributes of the input table produced by tabulate_rsp_subgroups
and tabulate_survival_subgroups
so that the user does not have to do this manually anymore.g_km
:
-s_surv_time
function to use a newly created function range_noinf
instead of base::range
.no_fillin_visits
added to h_adsl_adlb_merge_using_worst_flag
to specify excluded visits from the post-baseline worst toxicity grade output. Improved h_adsl_adlb_merge_using_worst_flag
to include variables shared between adsl
and adlb
, along with PARAM
, PARAMCD
, ATOXGR
, BTOXGR
and optionally AVISIT
, AVISITN
when by_visit = TRUE
. Prior output contained USUBJID
, ARMCD
, PARAMCD
, ATOXGR
, and BTOXGR
.s_surv_timepoint
for cases when there are zero patients at risk.s_surv_timepoint
for cases when there are zero patients at risk.stat_median_ci
function so that when passing empty var with empty name, no row names contain missing values
error would show.s_cox_univariate
function, use fit_coxreg_univar
function instead.s_cox_univariate
function, use fit_coxreg_univar
function instead.hr
and hr_ci
in a_coxph_pairwise
and median in s_surv_time
to align with STREAM.test-table_ttet01.R
and test-table_dort01.R
to make sure the analysis variable EVNT1
has both levels of the factor defined.position_surv_med
added to g_km
to move position of the annotation table with median survival times.position_surv_med
added to g_km
to move position of the annotation table with median survival times.g_km
related to the ignored arguments pch
and size
which were not passed on to helper function h_ggkm
.xticks
and max_time
arguments in g_km
for greater functionality. max_time
added as an argument in h_xticks
to allow this.prop_diff_cmh
that led to NaN
weighted proportion difference estimates and missing confidence intervals. Before this change, when including no patients from one treatment arm for at least one stratum the estimation did not lead to numeric results.This version of tern
introduces a major rewriting of tern
due to the change to layout based tabulation in rtables
. tern
now does not build tables directly anymore, instead it provides analysis functions to build tables, see the examples. * Counting patients with abnormal values post-baseline with count_abnormal
. * Counting patients with graded abnormal values with count_abnormal_by_worst_grade
. * Counting patients with abnormal values by baseline status with count_abnormal_by_baseline
. * Counting patients with missed doses with s_count_missed_doses
and count_missed_doses
. * Counting patients with event flags with count_patients_with_event
and count_patients_with_flags
. * Summarizing variables with summarize_vars
(supports numeric, factor, character and logical variables). Note that factors need to have NA
s converted to na_level
before use. * Summarizing change from baseline with summarize_change
. * Summarizing variables in columns with summarize_colvars
. * Estimating difference for responder proportions with estimate_proportion_diff
. * Estimating difference for Odds Ratio with estimate_odds_ratio
. * Testing the difference in responder proportions with test_proportion_diff
. * Estimating the responder proportion for the level of a factor with estimate_multinomial_response
. * Fitting and tabulating the results of Cox regressions with fit_coxreg_univar
, fit_coxreg_multivar
and summarize_coxreg
, respectively. * Pruning occurrence tables (or tables with counts and fractions) with flexible rules, see ?prune_occurrences
for details. * Sorting occurrence tables using different options, see ?score_occurrences
for details. * Fitting and tabulating MMRM models with fit_mmrm
and as.rtable
and summarize_lsmeans
, see ?tabulate_mmrm
for details. * Counting the number of unique and non-unique patients with summarize_num_patients
. * Counting occurrences with count_occurrences
. * Counting occurrences by grade with summarize_occurrences_by_grade
and count_occurrences_by_grade
. * Counting patients and events in columns with summarize_patients_events_in_cols
. * Tabulating the binary outcome response by subgroup with extract_rsp_subgroups
and tabulate_rsp_subgroups
. * Tabulating the survival duration by subgroup with extract_survival_subgroups
and tabulate_survival_subgroups
.
a_mean_sd
, a_median
, a_n_true_and_freq
, a_count
, a_q1q3
, a_iqr
, a_range
.a_mean_sd
, a_median
, a_n_true_and_freq
, a_count
, a_q1q3
, a_iqr
, a_range
.s_test_proportion_diff
: Chi-Squared Test with Schouten Correction.t_contingency
for contingency tables.splitText
to dynamicSplitText
to resolve the name conflict with the package ggpubr
.row_by
argument, inputs no longer require use of nested_by
.row_by
argument, inputs no longer require use of nested_by
.stat_mean_ci
and stat_median_ci
for error bars in ggplot2
.t_coxreg
as single interface for diverse cox regression types.t_binary_endpoint
and elementary functions: t_el_proportion
, t_el_proportion_diff
and t_el_test_proportion_diff
. The supporting summary functions added are: s_proportion
, s_adj_proportion_diff
, s_proportion_diff
and s_test_proportion_diff
.test.nest
dependency.test.nest
dependency.N
in t_summary
.N
in t_summary
.t_logistic
for multi-variable logistic regression table.df_explicit_na
to replace NA
by explicit values.node
S4 class to create trees:
-node
S4 class to create trees:
+rtables
.rtables
.keys
and keys<-
functions.tabulate_pairwise
.tabulate_pairwise
.get_N
, col_N_add_total
, check_id
.test.nest
tests:
-width_row.names
argument of g_forest
function into width_row_names
.width_row.names
argument of g_forest
function into width_row_names
.censor.show
argument of g_km
function into censor_show
.col.legend.title
argument of g_waterfall
function into col_legend_title
.na.rm
argument of t_count_unique
function into na_rm
.addTable
, t_summarize_by_visit
, t_summarize_variables
.addTable
, t_summarize_by_visit
, t_summarize_variables
.t_summary_by
function.g_km
function, renamed kmGrob
into kmCurveGrob
.t_events_*
family of functions.t_summary
and methods for data.frame
, numeric
, logical
, character
, factor
, and Date
objects.t_events_per_term_id
, t_events_per_term_grade_id
: Adverse Events & Concomitant Treatment Tables.t_tte
now shows two rows with ranges for event and censored times, respectively.g_km
works with one arm survfit
objects.n
instead of N
as a denominator for calculating percentages for factors by default.t_rsp
now works when all response values are TRUE
or FALSE
.id
(defaults to USUBJID
), a variable to indicate unique subject identifiers, and baseline
(defaults to BNRIND
), a variable to indicate baseline reference ranges.
For each direction specified via the abnormal
parameter (e.g. High or Low), a fraction of
-patient counts is returned, with numerator and denominator calculated as follows:
num
: The number of patients with this abnormality recorded while on treatment.
num
: The number of patients with this abnormality recorded while on treatment.
denom
: The total number of patients with at least one post-baseline assessment.
This function assumes that df
has been filtered to only include post-baseline records.
This function assumes that df
has been filtered to only include post-baseline records.
(PreDataTableLayouts
)
layout that analyses will be added to.
(named list
)
list identifying the abnormal range level(s) in var
. Defaults to
list(Low = "LOW", High = "HIGH")
but you can also group different levels into the named list,
for example, abnormal = list(Low = c("LOW", "LOW LOW"), High = c("HIGH", "HIGH HIGH"))
.
(named list
of string
)
list of additional analysis variables.
(flag
)
whether to exclude subjects with baseline abnormality
from numerator and denominator.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
additional arguments for the lower level functions.
(character
)
this can be customized in the case that the same vars
are analyzed multiple
times, to avoid warnings from rtables
.
(character
)
statistics to select for the table.
Options are: 'fraction'
(character
)
statistics to select for the table.
Options are: 'fraction'
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(data.frame
)
data set containing all analysis variables.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
count_abnormal()
returns a layout object suitable for passing to further layouting functions,
+
count_abnormal()
returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted rows containing
the statistics from s_count_abnormal()
to the table layout.
s_count_abnormal()
returns the statistic fraction
which is a vector with num
and denom
counts of patients.
a_count_abnormal()
returns the corresponding list with formatted rtables::CellValue()
.
s_count_abnormal()
returns the statistic fraction
which is a vector with num
and denom
counts of patients.
a_count_abnormal()
returns the corresponding list with formatted rtables::CellValue()
.
count_abnormal()
: Layout-creating function which can take statistics function arguments
+
count_abnormal()
: Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_count_abnormal()
: Statistics function which counts patients with abnormal range values
for a single abnormal
level.
a_count_abnormal()
: Formatted analysis function which is used as afun
in count_abnormal()
.
count_abnormal()
only considers a single variable that contains multiple abnormal levels.
count_abnormal()
only considers a single variable that contains multiple abnormal levels.
df
should be filtered to only include post-baseline records.
The denominator includes patients that may have other abnormal levels at baseline,
and patients missing baseline records. Patients with these abnormalities at
baseline can be optionally excluded from numerator and denominator via the
exclude_base_abn
parameter.
For each direction specified via the abnormal
parameter (e.g. High or Low), we condition on baseline
range result and count patients in the numerator and denominator as follows for each of the following
-categories:
Not <abnormality>
num
: The number of patients without abnormality at baseline (excluding those with missing baseline)
+categories:
Not <abnormality>
num
: The number of patients without abnormality at baseline (excluding those with missing baseline)
and with at least one abnormality post-baseline.
denom
: The number of patients without abnormality at baseline (excluding those with missing baseline).
<Abnormality>
num
: The number of patients with abnormality as baseline and at least one abnormality post-baseline.
<Abnormality>
num
: The number of patients with abnormality as baseline and at least one abnormality post-baseline.
denom
: The number of patients with abnormality at baseline.
Total
num
: The number of patients with at least one post-baseline record and at least one abnormality
+
Total
num
: The number of patients with at least one post-baseline record and at least one abnormality
post-baseline.
denom
: The number of patients with at least one post-baseline record.
This function assumes that df
has been filtered to only include post-baseline records.
This function assumes that df
has been filtered to only include post-baseline records.
(PreDataTableLayouts
)
layout that analyses will be added to.
(character
)
values identifying the abnormal range level(s) in .var
.
(named list
of string
)
list of additional analysis variables.
(string
)
the explicit na_level
argument you used in the pre-processing steps (maybe with
df_explicit_na()
). The default is "<Missing>"
.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
additional arguments for the lower level functions.
(character
)
this can be customized in the case that the same vars
are analyzed multiple
times, to avoid warnings from rtables
.
(character
)
statistics to select for the table.
Options are: 'fraction'
(character
)
statistics to select for the table.
Options are: 'fraction'
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(data.frame
)
data set containing all analysis variables.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
count_abnormal_by_baseline()
returns a layout object suitable for passing to further layouting functions,
+
count_abnormal_by_baseline()
returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted rows containing
the statistics from s_count_abnormal_by_baseline()
to the table layout.
s_count_abnormal_by_baseline()
returns statistic fraction
which is a named list with 3 labeled elements:
+
s_count_abnormal_by_baseline()
returns statistic fraction
which is a named list with 3 labeled elements:
not_abnormal
, abnormal
, and total
. Each element contains a vector with num
and denom
patient counts.
a_count_abnormal_by_baseline()
returns the corresponding list with formatted rtables::CellValue()
.
a_count_abnormal_by_baseline()
returns the corresponding list with formatted rtables::CellValue()
.
count_abnormal_by_baseline()
: Layout-creating function which can take statistics function arguments
+
count_abnormal_by_baseline()
: Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_count_abnormal_by_baseline()
: Statistics function for a single abnormal
level.
a_count_abnormal_by_baseline()
: Formatted analysis function which is used as afun
in count_abnormal_by_baseline()
.
df
should be filtered to include only post-baseline records.
df
should be filtered to include only post-baseline records.
If the baseline variable or analysis variable contains NA
records, it is expected that df
has been
pre-processed using df_explicit_na()
or explicit_na()
.
df <- data.frame(
USUBJID = as.character(c(1:6)),
ANRIND = factor(c(rep("LOW", 4), "NORMAL", "HIGH")),
@@ -297,17 +409,19 @@ Examples
direction
(defaults to abn_dir
), a variable to indicate
abnormality directions.
For each combination of param
and direction
levels, marked lab abnormality counts are calculated
-as follows:
Single, not last
& Last or replicated
: The number of patients with Single, not last
+as follows:
Single, not last
& Last or replicated
: The number of patients with Single, not last
and Last or replicated
values, respectively.
Any
: The number of patients with either single or replicated marked abnormalities.
Fractions are calculated by dividing the above counts by the number of patients with at least one +
Fractions are calculated by dividing the above counts by the number of patients with at least one valid measurement recorded during the analysis.
Prior to using this function in your table layout you must use rtables::split_rows_by()
to create two
row splits, one on variable param
and one on variable direction
.
(PreDataTableLayouts
)
layout that analyses will be added to.
(list
)
a list with different marked category names for single
and last or replicated.
(named list
of string
)
list of additional analysis variables.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
additional arguments for the lower level functions.
(character
)
statistics to select for the table.
Options are: 'count_fraction', 'count_fraction_fixed_dp'
(character
)
statistics to select for the table.
Options are: 'count_fraction', 'count_fraction_fixed_dp'
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(data.frame
)
data set containing all analysis variables.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
(data.frame
)
gives information about ancestor split states
that is passed by rtables
.
count_abnormal_by_marked()
returns a layout object suitable for passing to further layouting functions,
+
count_abnormal_by_marked()
returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted rows containing
the statistics from s_count_abnormal_by_marked()
to the table layout.
s_count_abnormal_by_marked()
returns statistic count_fraction
with Single, not last
,
+
s_count_abnormal_by_marked()
returns statistic count_fraction
with Single, not last
,
Last or replicated
, and Any
results.
a_count_abnormal_by_marked()
returns the corresponding list with formatted rtables::CellValue()
.
a_count_abnormal_by_marked()
returns the corresponding list with formatted rtables::CellValue()
.
count_abnormal_by_marked()
: Layout-creating function which can take statistics function arguments
+
count_abnormal_by_marked()
: Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_count_abnormal_by_marked()
: Statistics function for patients with marked lab abnormalities.
a_count_abnormal_by_marked()
: Formatted analysis function which is used as afun
in count_abnormal_by_marked()
.
Single, not last
and Last or replicated
levels are mutually exclusive. If a patient has
abnormalities that meet both the Single, not last
and Last or replicated
criteria, then the
patient will be counted only under the Last or replicated
category.
grade_dir
(defaults to GRADE_DIR
), a variable to indicate directions
(e.g. High or Low) for each toxicity grade supplied in var
.
For each combination of param
and grade_dir
levels, patient counts by worst
-grade are calculated as follows:
1
to 4
: The number of patients with worst grades 1-4, respectively.
1
to 4
: The number of patients with worst grades 1-4, respectively.
Any
: The number of patients with at least one abnormality (i.e. grade is not 0).
Fractions are calculated by dividing the above counts by the number of patients with at least one +
Fractions are calculated by dividing the above counts by the number of patients with at least one valid measurement recorded during treatment.
Pre-processing is crucial when using this function and can be done automatically using the
h_adlb_abnormal_by_worst_grade()
helper function. See the description of this function for details on the
@@ -108,7 +174,8 @@
(PreDataTableLayouts
)
layout that analyses will be added to.
(named list
of string
)
list of additional analysis variables.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
additional arguments for the lower level functions.
(character
)
statistics to select for the table.
Options are: 'count_fraction', 'count_fraction_fixed_dp'
(character
)
statistics to select for the table.
Options are: 'count_fraction', 'count_fraction_fixed_dp'
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(data.frame
)
data set containing all analysis variables.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
(data.frame
)
gives information about ancestor split states
that is passed by rtables
.
count_abnormal_by_worst_grade()
returns a layout object suitable for passing to further layouting functions,
+
count_abnormal_by_worst_grade()
returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted rows containing
the statistics from s_count_abnormal_by_worst_grade()
to the table layout.
s_count_abnormal_by_worst_grade()
returns the single statistic count_fraction
with grades 1 to 4 and
+
s_count_abnormal_by_worst_grade()
returns the single statistic count_fraction
with grades 1 to 4 and
"Any" results.
a_count_abnormal_by_worst_grade()
returns the corresponding list with formatted rtables::CellValue()
.
a_count_abnormal_by_worst_grade()
returns the corresponding list with formatted rtables::CellValue()
.
count_abnormal_by_worst_grade()
: Layout-creating function which can take statistics function arguments
+
count_abnormal_by_worst_grade()
: Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_count_abnormal_by_worst_grade()
: Statistics function which counts patients by worst grade.
a_count_abnormal_by_worst_grade()
: Formatted analysis function which is used as afun
in count_abnormal_by_worst_grade()
.
h_adlb_abnormal_by_worst_grade()
which pre-processes ADLB data frames to be used in
count_abnormal_by_worst_grade()
.
direction_var
(defaults to GRADDIR
), a variable to indicate toxicity grade
directions of interest to include (e.g. "H"
(high), "L"
(low), or "B"
(both)).
For the direction(s) specified in direction_var
, patient counts by worst grade for patients who have
-worsened from baseline are calculated as follows:
1
to 4
: The number of patients who have worsened from their baseline grades with worst
+worsened from baseline are calculated as follows:
1
to 4
: The number of patients who have worsened from their baseline grades with worst
grades 1-4, respectively.
Any
: The total number of patients who have worsened from their baseline grades.
Fractions are calculated by dividing the above counts by the number of patients who's analysis toxicity grades +
Fractions are calculated by dividing the above counts by the number of patients who's analysis toxicity grades have worsened from baseline toxicity grades during treatment.
Prior to using this function in your table layout you must use rtables::split_rows_by()
to create a row
split on variable direction_var
.
(PreDataTableLayouts
)
layout that analyses will be added to.
(named list
of string
)
list of additional analysis variables including:
id
(string
)
subject variable name.
(named list
of string
)
list of additional analysis variables including:
id
(string
)
subject variable name.
baseline_var
(string
)
name of the data column containing baseline toxicity variable.
direction_var
(string
)
see direction_var
for more details.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
additional arguments for the lower level functions.
(character
)
this can be customized in the case that the same vars
are analyzed multiple
times, to avoid warnings from rtables
.
(character
)
statistics to select for the table.
Options are: 'fraction'
(character
)
statistics to select for the table.
Options are: 'fraction'
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(data.frame
)
data set containing all analysis variables.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
count_abnormal_lab_worsen_by_baseline()
returns a layout object suitable for passing to further layouting
+
count_abnormal_lab_worsen_by_baseline()
returns a layout object suitable for passing to further layouting
functions, or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted
rows containing the statistics from s_count_abnormal_lab_worsen_by_baseline()
to the table layout.
s_count_abnormal_lab_worsen_by_baseline()
returns the counts and fraction of patients whose worst
+
s_count_abnormal_lab_worsen_by_baseline()
returns the counts and fraction of patients whose worst
post-baseline lab grades are worse than their baseline grades, for post-baseline worst grades
"1", "2", "3", "4" and "Any".
a_count_abnormal_lab_worsen_by_baseline()
returns the corresponding list with
+
a_count_abnormal_lab_worsen_by_baseline()
returns the corresponding list with
formatted rtables::CellValue()
.
count_abnormal_lab_worsen_by_baseline()
: Layout-creating function which can take statistics function
+
count_abnormal_lab_worsen_by_baseline()
: Layout-creating function which can take statistics function
arguments and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_count_abnormal_lab_worsen_by_baseline()
: Statistics function for patients whose worst post-baseline
lab grades are worse than their baseline grades.
a_count_abnormal_lab_worsen_by_baseline()
: Formatted analysis function which is used as afun
in count_abnormal_lab_worsen_by_baseline()
.
Relevant helper functions h_adlb_worsen()
and h_worsen_counter()
which are used within
s_count_abnormal_lab_worsen_by_baseline()
to process input data.
(string
)
name of reference arm to use in risk difference calculations.
(character
)
names of one or more arms to compare to reference arm in risk difference
calculations. A new column will be added for each value of arm_y
.
(character
)
labels to use when rendering the risk difference column within the table.
If more than one comparison arm is specified in arm_y
, default labels will specify which two arms are
being compared (reference arm vs. comparison arm).
(flag
)
whether output should be returned as percentages. Defaults to TRUE
.
A closure suitable for use as a split function (split_fun
) within rtables::split_cols_by()
when creating a table layout.
adae <- tern_ex_adae
adae$AESEV <- factor(adae$AESEV)
@@ -130,17 +204,19 @@ Examples
A modified layout where the latest row split labels now have the row-wise total counts (i.e. without column-based subsetting) attached in parentheses.
Row count values are contained in these row count rows but are not displayed so that they are not considered zero rows by default when pruning.
(data.frame
)
data set containing all analysis variables.
(string
)
label of the level of the parent split currently being summarized
(must be present as second argument in Content Row Functions). See rtables::summarize_row_groups()
for more information.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
(integer(1)
)
column-wise N (column count) for the full column being analyzed that is typically
passed by rtables
.
(integer(1)
)
row-wise N (row group count) for the group of observations being analyzed
(i.e. with no column-based subsetting) that is typically passed by rtables
.
(data.frame
)
data frame across all of the columns for the given row split.
(data.frame
)
gives information about ancestor split states
that is passed by rtables
.
(integer
)
vector where each value represents a global count for a column. Values are
taken from alt_counts_df
if specified (see rtables::build_table()
).
(character
)
statistics to select for the table.
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(string
)
string used to replace all NA
or empty values in the output.
(named list
)
a named list containing one name-value pair where the name corresponds to
the name of the statistics function that should be used in calculations and the value is the corresponding
analysis function.
(named list
)
additional arguments to be passed to the statistics function and analysis
function supplied in afun
.
stat_propdiff_ci()
for details on risk difference calculation.
stat_propdiff_ci()
for details on risk difference calculation.
Split function add_riskdiff()
which, when used as split_fun
within rtables::split_cols_by()
with
riskdiff
argument set to TRUE
in subsequent analyze functions calls, adds a risk difference column
to a table layout.
These functions are wrappers of rtables::analyze_colvars()
which apply corresponding tern
statistics functions to add an analysis to a given table layout. In particular, these functions
-where designed to have the analysis methods split into different columns.
analyze_vars_in_cols()
: fundamental tabulation of analysis methods onto columns.
+where designed to have the analysis methods split into different columns.
analyze_vars_in_cols()
: fundamental tabulation of analysis methods onto columns.
In other words, the analysis methods are defined in the column space, i.e. they become
column labels. By changing the variable vector, the list of functions can be applied on
different variables, with the caveat of having the same number of statistical functions.
tabulate_*
functions described above as it is designed to provide
specific standard tables that may contain nested structure with a combination of
summarize_row_groups()
and rtables::analyze_colvars()
.summarize_functions for functions which are wrappers for rtables::summarize_row_groups()
.
summarize_functions for functions which are wrappers for rtables::summarize_row_groups()
.
analyze_functions for functions which are wrappers for rtables::analyze()
.
These functions are wrappers of rtables::analyze()
which apply corresponding tern
statistics functions
-to add an analysis to a given table layout:
analyze_colvars_functions for functions that are wrappers for rtables::analyze_colvars()
.
analyze_colvars_functions for functions that are wrappers for rtables::analyze_colvars()
.
summarize_functions for functions which are wrappers for rtables::summarize_row_groups()
.
(PreDataTableLayouts
)
layout that analyses will be added to.
(character
)
variable names for the primary analysis variable to be iterated over.
(character
)
variable labels.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
arguments passed to s_summary()
.
(flag
)
whether NA
values should be removed from x
prior to analysis.
(string
)
label visibility: one of "default", "visible" and "hidden".
(character
)
this can be customized in the case that the same vars
are analyzed multiple
times, to avoid warnings from rtables
.
(string
)
string which should be repeated as a section divider after each group
defined by this split instruction, or NA_character_
(the default) for no section divider.
(character
)
statistics to select for the table.
(character
)
statistics to select for the table.
Options for numeric variables are: 'n', 'sum', 'mean', 'sd', 'se', 'mean_sd', 'mean_se', 'mean_ci', 'mean_sei', 'mean_sdi', 'mean_pval', 'median', 'mad', 'median_ci', 'quantiles', 'iqr', 'range', 'min', 'max', 'median_range', 'cv', 'geom_mean', 'geom_mean_ci', 'geom_cv', 'median_ci_3d', 'mean_ci_3d', 'geom_mean_ci_3d'
Options for non-numeric variables are: 'n', 'count', 'count_fraction', 'count_fraction_fixed_dp', 'fraction', 'n_blq'
Options for non-numeric variables are: 'n', 'count', 'count_fraction', 'count_fraction_fixed_dp', 'fraction', 'n_blq'
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Each element of the vector
should be a name-value pair with name corresponding to a statistic specified in .stats
and value the indentation
for that statistic's row label.
(numeric
)
vector of numbers we want to analyze.
(string
)
choice of denominator for proportion. Options are:
n
: number of values in this row and column intersection.
(string
)
choice of denominator for proportion. Options are:
n
: number of values in this row and column intersection.
N_row
: total number of values in this row across columns.
N_col
: total number of values in this column across rows.
(integer(1)
)
row-wise N (row group count) for the group of observations being analyzed
(i.e. with no column-based subsetting) that is typically passed by rtables
.
(integer(1)
)
column-wise N (column count) for the full column being analyzed that is typically
passed by rtables
.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
(list
)
parameters for descriptive statistics details, specified by using
-the helper function control_analyze_vars()
. Some possible parameter options are:
conf_level
(proportion
)
confidence level of the interval for mean and median.
(list
)
parameters for descriptive statistics details, specified by using
+the helper function control_analyze_vars()
. Some possible parameter options are:
conf_level
(proportion
)
confidence level of the interval for mean and median.
quantiles
(numeric(2)
)
vector of length two to specify the quantiles.
quantile_type
(numeric(1)
)
between 1 and 9 selecting quantile algorithms to be used.
See more about type
in stats::quantile()
.
test_mean
(numeric(1)
)
value to test against the mean under the null hypothesis when calculating p-value.
(flag
)
defaults to TRUE
, which prints out warnings and messages. It is mainly used
to print out information about factor casting.
(data.frame
)
data frame across all of the columns for the given row split.
(data.frame
or vector
)
the data corresponding to the reference group.
(flag
)TRUE
when working with the reference level, FALSE
otherwise.
(flag
)
whether comparison statistics should be analyzed instead of summary statistics
(compare = TRUE
adds pval
statistic comparing against reference group).
analyze_vars()
returns a layout object suitable for passing to further layouting functions,
+
analyze_vars()
returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted rows containing
the statistics from s_summary()
to the table layout.
s_summary()
returns different statistics depending on the class of x
.
If x
is of class numeric
, returns a list
with the following named numeric
items:
n
: The length()
of x
.
s_summary()
returns different statistics depending on the class of x
.
If x
is of class numeric
, returns a list
with the following named numeric
items:
n
: The length()
of x
.
sum
: The sum()
of x
.
mean
: The mean()
of x
.
sd
: The stats::sd()
of x
.
cv
: The coefficient of variation of x
, i.e.: (stats::sd()
/ mean()
* 100).
geom_mean
: The geometric mean of x
, i.e.: (exp(mean(log(x)))
).
geom_cv
: The geometric coefficient of variation of x
, i.e.: (sqrt(exp(sd(log(x)) ^ 2) - 1) * 100
).
If x
is of class factor
or converted from character
, returns a list
with named numeric
items:
n
: The length()
of x
.
If x
is of class factor
or converted from character
, returns a list
with named numeric
items:
n
: The length()
of x
.
count
: A list with the number of cases for each level of the factor x
.
count_fraction
: Similar to count
but also includes the proportion of cases for each level of the
factor x
relative to the denominator, or NA
if the denominator is zero.
If x
is of class logical
, returns a list
with named numeric
items:
n
: The length()
of x
(possibly after removing NA
s).
If x
is of class logical
, returns a list
with named numeric
items:
n
: The length()
of x
(possibly after removing NA
s).
count
: Count of TRUE
in x
.
count_fraction
: Count and proportion of TRUE
in x
relative to the denominator, or NA
if the
denominator is zero. Note that NA
s in x
are never counted or leading to NA
here.
a_summary()
returns the corresponding list with formatted rtables::CellValue()
.
a_summary()
returns the corresponding list with formatted rtables::CellValue()
.
Automatic digit formatting: The number of digits to display can be automatically determined from the analyzed
variable(s) (vars
) for certain statistics by setting the statistic format to "auto"
in .formats
.
This utilizes the format_auto()
formatting function. Note that only data for the current row & variable (for all
columns) will be considered (.df_row[[.var]]
, see rtables::additional_fun_params
) and not the whole dataset.
analyze_vars()
: Layout-creating function which can take statistics function arguments
+
analyze_vars()
: Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_summary()
: S3 generic function to produces a variable summary.
s_summary(numeric)
: Method for numeric
class.
cfun
in summarize_colvars()
.If x
is an empty vector, NA
is returned. This is the expected feature so as to return rcell
content in
+
If x
is an empty vector, NA
is returned. This is the expected feature so as to return rcell
content in
rtables
when the intersection of a column and a row delimits an empty data selection.
When the mean
function is applied to an empty vector, NA
will be returned instead of NaN
, the latter
being standard behavior in R.
If x
is an empty factor
, a list is still returned for counts
with one element
+
If x
is an empty factor
, a list is still returned for counts
with one element
per factor level. If there are no levels in x
, the function fails.
If factor variables contain NA
, these NA
values are excluded by default. To include NA
values
set na.rm = FALSE
and missing values will be displayed as an NA
level. Alternatively, an explicit
factor level can be defined for NA
values during pre-processing via df_explicit_na()
- the
default na_level
("<Missing>"
) will also be excluded when na.rm
is set to TRUE
.
Automatic conversion of character to factor does not guarantee that the table +
Automatic conversion of character to factor does not guarantee that the table
can be generated correctly. In particular for sparse tables this very likely can fail.
It is therefore better to always pre-process the dataset such that factors are manually
created from character variables before passing the dataset to rtables::build_table()
.
To use for comparison (with additional p-value statistic), parameter compare
must be set to TRUE
.
To use for comparison (with additional p-value statistic), parameter compare
must be set to TRUE
.
Ensure that either all NA
values are converted to an explicit NA
level or all NA
values are left as is.
## Fabricated dataset.
dta_test <- data.frame(
USUBJID = rep(1:6, each = 3),
@@ -2538,17 +2679,19 @@ Examples
(PreDataTableLayouts
)
layout that analyses will be added to.
(character
)
variable names for the primary analysis variable to be iterated over.
additional arguments for the lower level functions.
(character
)
statistics to select for the table.
(named character
)
labels for the statistics (without indent).
(character
)
as this function works in columns space, usually .labels
character vector applies on the column space. You can change the row labels by defining this
parameter to a named character vector with names corresponding to the split values. It defaults
to NULL
and if it contains only one string
, it will duplicate that as a row label.
(flag
)
defaults to FALSE
and applies the analysis to the current
label rows. This is a wrapper of rtables::summarize_row_groups()
and it can accept labelstr
to define row labels. This behavior is not supported as we never need to overload row labels.
(flag
)
defaults to TRUE
and puts the analysis results onto the columns.
This option allows you to add multiple instances of this functions, also in a nested fashion,
without adding more splits. This split must happen only one time on a single layout.
(string
or NULL
)
imputation rule setting. Defaults to NULL
for no imputation rule. Can
also be "1/3"
to implement 1/3 imputation rule or "1/2"
to implement 1/2 imputation rule. In order
to use an imputation rule, the avalcat_var
argument must be specified. See imputation_rule()
for more details on imputation.
(string
)
if imp_rule
is not NULL
, name of variable that indicates whether a
row in the data corresponds to an analysis value in category "BLQ"
, "LTR"
, "<PCLLOQ"
, or none of
the above (defaults to "AVALCAT1"
). Variable must be present in the data and should match the variable
used to calculate the n_blq
statistic (if included in .stats
).
(flag
)
whether to store computed values in a temporary caching environment. This will
speed up calculations in large tables, but should be set to FALSE
if the same rtable
layout is
used for multiple tables with different data. Defaults to FALSE
.
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(character
or NULL
)
alignment for table contents (not including labels). When NULL
,
"center"
is applied. See formatters::list_valid_aligns()
for a list of all currently supported alignments.
A layout object suitable for passing to further layouting functions, or to rtables::build_table()
.
Adding this function to an rtable
layout will summarize the given variables, arrange the output
in columns, and add it to the table layout.
This is an experimental implementation of rtables::summarize_row_groups()
and rtables::analyze_colvars()
+
This is an experimental implementation of rtables::summarize_row_groups()
and rtables::analyze_colvars()
that may be subjected to changes as rtables
extends its support to more complex analysis pipelines in the
column space. We encourage users to read the examples carefully and file issues for different use cases.
In this function, labelstr
behaves atypically. If labelstr = NULL
(the default), row labels are assigned
automatically as the split values if do_summarize_row_groups = FALSE
(the default), and as the group label
if do_summarize_row_groups = TRUE
.
(PreDataTableLayouts
)
layout that analyses will be added to.
(data.frame
)
data set containing all analysis variables.
(character
)
variable names of which the labels are to be looked up in df
.
(integer(1)
)
non-negative number of nested indent space, default to 0L which means no indent.
1L means two spaces indent, 2L means four spaces indent and so on.
This is not an optimal implementation of course, since we are using here the data set
itself during the layout creation. When we have a more mature rtables
implementation then
this will also be improved or not necessary anymore.
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named list
)
a named list of statistics where each element corresponds
to an element in .formats
, with matching names.
(data.frame
)
data frame across all of the columns for the given row split.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
additional arguments for the lower level functions.
(character
or NULL
)
alignment for table contents (not including labels). When NULL
,
"center"
is applied. See formatters::list_valid_aligns()
for a list of all currently supported alignments.
(integer
)
vector where each value represents a global count for a column. Values are
taken from alt_counts_df
if specified (see rtables::build_table()
).
(data.frame
)
data frame across all of the columns for the given row split.
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(flag
)TRUE
when working with the reference level, FALSE
otherwise.
(named integer
)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(named character
)
labels for the statistics (without indent).
(integer(1)
)
column-wise N (column count) for the full column being analyzed that is typically
passed by rtables
.
(integer(1)
)
row-wise N (row group count) for the group of observations being analyzed
(i.e. with no column-based subsetting) that is typically passed by rtables
.
(data.frame
or vector
)
the data corresponding to the reference group.
(data.frame
)
gives information about ancestor split states
that is passed by rtables
.
(character
)
statistics to select for the table.
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
(flag
)
adds a "total" level after the others which includes all the levels
that constitute the split. A custom label can be set for this level via the custom_label
argument.
(factor
)
defining column groups.
(proportion
)
confidence level of the interval.
(data.frame
)
the dataset containing the variables to summarize.
(string
)
choice of denominator for proportion. Options are:
n
: number of values in this row and column intersection.
(string
)
choice of denominator for proportion. Options are:
n
: number of values in this row and column intersection.
N_row
: total number of values in this row across columns.
N_col
: total number of values in this column across rows.
(data.frame
)
data set containing all analysis variables.
(named list
of list
)
optionally contains for each subgroups
variable a
list, which specifies the new group levels via the names and the
levels that belong to it in the character vectors that are elements of the list.
(string
)
subject variable name.
(flag
)TRUE
if event, FALSE
if time to event is censored.
(string
)
label for the total population analysis.
(string
)
label of the level of the parent split currently being summarized
(must be present as second argument in Content Row Functions). See rtables::summarize_row_groups()
for more information.
(PreDataTableLayouts
)
layout that analyses will be added to.
(string
or NULL
)
specifies the test used to calculate the p-value for the difference between
two proportions. For options, see test_proportion_diff()
. Default is NULL
so no test is performed.
(flag
)
whether NA
values should be removed from x
prior to analysis.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
(flag
)
whether to prune all zero rows.
(flag
)
whether a risk difference column is present. When set to TRUE
, add_riskdiff()
must be
used as split_fun
in the prior column split of the table layout, specifying which columns should be compared.
See stat_propdiff_ci()
for details on risk difference calculation.
(logical
)
vector indicating whether each subject is a responder or not.
(string
)
label visibility: one of "default", "visible" and "hidden".
(string
)
string which should be repeated as a section divider after each group
defined by this split instruction, or NA_character_
(the default) for no section divider.
(character
)
this can be customized in the case that the same vars
are analyzed multiple
times, to avoid warnings from rtables
.
(numeric
)
vector of time-to-event duration values.
(character
)
variable labels.
(named list
of string
)
list of additional analysis variables.
(character
)
variable names for the primary analysis variable to be iterated over.
(string
)
single variable name for the primary analysis variable.
(numeric
)
vector of numbers we want to analyze.
(numeric(2)
)
vector containing lower and upper limits for the x-axis, respectively.
If NULL
(default), the default scale range is used.
(numeric(2)
)
vector containing lower and upper limits for the y-axis, respectively.
If NULL
(default), the default scale range is used.
Although this function just returns NULL
it has two uses, for
the tern
users it provides a documentation of arguments that are
commonly and consistently used in the framework. For the developer it adds a
@@ -269,17 +384,19 @@
arrange_grobs(
...,
grobs = list(...),
@@ -69,52 +133,66 @@ Usage
grobs.
(list
of grob
)
a list of grobs.
(integer(1)
)
number of columns in layout.
(integer(1)
)
number of rows in layout.
(grid::unit
)
unit of length 1, vertical space between each grob.
(grid::unit
)
unit of length 1, horizontal space between each grob.
(viewport
or NULL
)
a viewport()
object (or NULL
).
(gpar
)
a gpar()
object.
(string
)
a character identifier for the grob.
An rtables
table object. Note that the concrete class will depend on the method used.
as.rtable(data.frame)
: Method for converting a data.frame
that contains numeric columns to rtable
.
as.rtable(data.frame)
: Method for converting a data.frame
that contains numeric columns to rtable
.
as_factor_keep_attributes(
x,
x_name = deparse(substitute(x)),
@@ -67,42 +131,52 @@ Usage
A factor
with same attributes (except class) as x
. Does not modify x
if already a factor
.
checkmate
checkmate
+R/utils_checkmate.R
assertions.Rd
assert_list_of_variables(x, .var.name = checkmate::vname(x), add = NULL)
assert_df_with_variables(
@@ -89,85 +154,104 @@ Usage
(any
)
object to test.
[character(1)
]
Name of the checked object to print in assertions. Defaults to
the heuristic implemented in vname
.
[AssertCollection
]
Collection to store assertion messages. See AssertCollection
.
(data.frame
)
data set to test.
(named list
of character
)
list of variables to test.
(string
)
the string you have been using to represent NA or
missing data. For NA
values please consider using directly is.na()
or
similar approaches.
[integer(1)
]
Minimum number of factor levels.
Default is NULL
(no check).
[integer(1)
]
Maximum number of factor levels.
Default is NULL
(no check).
[logical(1)
]
If set to TRUE
, x
may also be NULL
.
In this case only a type check of x
is performed, all additional checks are disabled.
[logical(1)
]
Are vectors with missing values allowed? Default is TRUE
.
[integer(1)
]
Exact number of factor levels.
Default is NULL
(no check).
[integer(1)
]
Exact expected length of x
.
(flag
)
whether to include boundaries when testing
for proportions.
assert_list_of_variables()
: Checks whether x
is a valid list of variable names.
+
assert_list_of_variables()
: Checks whether x
is a valid list of variable names.
NULL
elements of the list x
are dropped with Filter(Negate(is.null), x)
.
assert_df_with_variables()
: Check whether df
is a data frame with the analysis variables
.
Please notice how this produces an error when not all variables are present in the
@@ -178,20 +262,23 @@
NA
levels out of the vector list itself.assert_proportion_value()
: Check whether x
is a proportion: number between 0 and 1.
(data.frame
)
data set containing all analysis variables.
(string
)
label of the level of the parent split currently being summarized
(must be present as second argument in Content Row Functions). See rtables::summarize_row_groups()
for more information.
(integer(1)
)
row-wise N (row group count) for the group of observations being analyzed
(i.e. with no column-based subsetting) that is typically passed by rtables
.
A list with formatted rtables::CellValue()
with the row count value and the correct label.
It is important here to not use df
but rather .N_row
in the implementation, because
the former is already split by columns and will refer to the first column of the data only.
c_label_n_alt()
which performs the same function but retrieves row counts from
alt_counts_df
instead of df
.
(data.frame
)
data set containing all analysis variables.
(string
)
label of the level of the parent split currently being summarized
(must be present as second argument in Content Row Functions). See rtables::summarize_row_groups()
for more information.
A list with formatted rtables::CellValue()
with the row count value and the correct label.
c_label_n()
which performs the same function but retrieves row counts from df
instead
of alt_counts_df
.
A content function which gives df$analysis_var
at the row identified by
.df_row$flag
in the given format.
(logical
)
vector indicating whether each subject is a responder or not.
(factor
)
vector assigning observations to one out of two groups
(e.g. reference and treatment group).
(factor
)
variable with one level per stratum and same length as rsp
.
(proportion
)
confidence level of the interval.
(flag
)
whether to include the continuity correction. For further
information, see stats::prop.test()
.
CombinationFunction
CombinationFunction
+R/combination_function.R
combination_function.Rd
A logical value indicating whether the left hand side of the equation equals the right hand side.
e1 & e2
: Logical "AND" combination of CombinationFunction
functions.
+
e1 & e2
: Logical "AND" combination of CombinationFunction
functions.
The resulting object is of the same class, and evaluates the two argument functions. The result
is then the "AND" of the two individual results.
e1 | e2
: Logical "OR" combination of CombinationFunction
functions.
@@ -100,10 +174,12 @@
higher <- function(a) {
force(a)
CombinationFunction(
@@ -131,17 +207,19 @@ Examples
ref <- c("A: Drug X", "B: Placebo")
groups <- combine_groups(fct = DM$ARM, ref = ref)
@@ -123,17 +195,19 @@ Examples
groups <- combine_groups(
fct = DM$ARM,
ref = c("B: Placebo")
@@ -105,17 +177,19 @@ Examples
(PreDataTableLayouts
)
layout that analyses will be added to.
(character
)
variable names for the primary analysis variable to be iterated over.
(character
)
variable labels.
(string
)
string used to replace all NA
or empty values in the output.
(flag
)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE
, the default) or as a new top-level element (FALSE
). Ignored if it would nest a split.
underneath analyses, which is not allowed.
arguments passed to s_compare()
.
(flag
)
whether NA
values should be removed from x
prior to analysis.
(string
)
label visibility: one of "default", "visible" and "hidden".
(character
)
this can be customized in the case that the same vars
are analyzed multiple
times, to avoid warnings from rtables
.
(string
)
string which should be repeated as a section divider after each group
defined by this split instruction, or NA_character_
(the default) for no section divider.
(character
)
statistics to select for the table.
(character
)
statistics to select for the table.
Options for numeric variables are: 'n', 'sum', 'mean', 'sd', 'se', 'mean_sd', 'mean_se', 'mean_ci', 'mean_sei', 'mean_sdi', 'mean_pval', 'median', 'mad', 'median_ci', 'quantiles', 'iqr', 'range', 'min', 'max', 'median_range', 'cv', 'geom_mean', 'geom_mean_ci', 'geom_cv', 'median_ci_3d', 'mean_ci_3d', 'geom_mean_ci_3d', 'pval'
Options for non-numeric variables are: 'n', 'count', 'count_fraction', 'count_fraction_fixed_dp', 'fraction', 'n_blq', 'pval_counts'
Options for non-numeric variables are: 'n', 'count', 'count_fraction', 'count_fraction_fixed_dp', 'fraction', 'n_blq', 'pval_counts'
(named character
or list
)
formats for the statistics. See Details in analyze_vars
for more
information on the "auto"
setting.
(named character
)
labels for the statistics (without indent).
(named integer
)
indent modifiers for the labels. Each element of the vector
should be a name-value pair with name corresponding to a statistic specified in .stats
and value the indentation
for that statistic's row label.
(numeric
)
vector of numbers we want to analyze.
(data.frame
or vector
)
the data corresponding to the reference group.
(flag
)TRUE
when working with the reference level, FALSE
otherwise.
(string
)
choice of denominator for factor proportions,
can only be n
(number of values in this row and column intersection).
(string
)
single variable name that is passed by rtables
when requested
by a statistics function.
(flag
)
whether warnings and messages should be printed. Mainly used
to print out information about factor casting. Defaults to TRUE
.
compare_vars()
returns a layout object suitable for passing to further layouting functions,
+
compare_vars()
returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted rows containing
the statistics from s_compare()
to the table layout.
s_compare()
returns output of s_summary()
and comparisons versus the reference group in the form of p-values.
s_compare()
returns output of s_summary()
and comparisons versus the reference group in the form of p-values.
compare_vars()
: Layout-creating function which can take statistics function arguments
+
compare_vars()
: Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_compare()
: S3 generic function to produce a comparison summary.
s_compare(numeric)
: Method for numeric
class. This uses the standard t-test
@@ -238,11 +334,14 @@
For factor variables, denom
for factor proportions can only be n
since the purpose is to compare proportions
+
For factor variables, denom
for factor proportions can only be n
since the purpose is to compare proportions
between columns, therefore a row-based proportion would not make sense. Proportion based on N_col
would
be difficult since we use counts for the chi-squared test statistic, therefore missing values should be accounted
for as explicit factor levels.
For compare_vars()
, the column split must define a reference group via ref_group
so that the comparison
is well defined.
s_summary()
which is used internally to compute a summary within s_compare()
, and a_summary()
which is used (with compare = TRUE
) as the analysis function for compare_vars()
.
control_analyze_vars(
conf_level = 0.95,
quantiles = c(0.25, 0.75),
@@ -67,45 +131,55 @@ Usage
(proportion
)
confidence level of the interval.
(numeric(2)
)
vector of length two to specify the quantiles to calculate.
(numeric(1)
)
number between 1 and 9 selecting quantile algorithms to be used.
Default is set to 2 as this matches the default quantile algorithm in SAS proc univariate
set by QNTLDEF=5
.
This differs from R's default. See more about type
in stats::quantile()
.
(numeric(1)
)
number to test against the mean under the null hypothesis when calculating
p-value.