Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fixed `s_kaplan_meier()` range censoring indicator handling to no longer produce `NA` values in the output when either all subjects are censored or none are censored.
- Aligned `a_freq_resp_var_j()` with `a_freq_j()` by adding `.formats` and `na_str` parameters to allow user customization of output formatting and NA string representation (#67).
- Fixed the hanging indent in the first column of the body of the table (#138)
- Export `leftside()`, `postfun_eq5d` `ac_blank_line` and `tt_to_tblfile`
- Minor bugfix in DOCX exporter when calculating the number of pages (#188)
Expand Down
14 changes: 11 additions & 3 deletions R/a_freq_resp_var_j.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#' @param conf_level (`proportion`)\cr confidence level of the interval.
#' @param method (`character`)\cr method for calculating confidence intervals.
#' @param weights_method (`character`)\cr method for calculating weights.
#' @param .formats (`character` or NULL)\cr formats to apply to the statistics. If NULL, default formats will be used.
#' @param na_str (`character`)\cr string to use for NA values. Defaults to `rep("NA", 3)`.
#' @param ... Additional arguments passed to other functions.
#'
#' @return Formatted analysis function which is used as `afun` in `analyze_vars()`
Expand Down Expand Up @@ -68,6 +70,8 @@
"strat_newcombecc"
),
weights_method = formals(s_proportion_diff)$weights_method,
.formats = NULL,
na_str = rep("NA", 3),
...) {
# ---- Derive statistics: xx / xx (xx.x%)

Expand Down Expand Up @@ -166,16 +170,18 @@

.stat <- "count_unique_denom_fraction"
x_stat <- rslt[[.stat]]$Y
rslt <- rcell(x_stat, format = jjcsformat_count_denom_fraction)
# use .formats if provided, otherwise default to jjcsformat_count_denom_fraction
fmt <- if (is.null(.formats)) jjcsformat_count_denom_fraction else .formats
rslt <- rcell(x_stat, format = fmt)
} else {
# use the risk differenc function s_rel_risk_val_j on the current level of the incoming variable (.var)
# note that the response variable will become .var in the below call
# val is restricted to Y to show number of response on the current level of .var
denom_df <- dfrowii

Check warning on line 181 in R/a_freq_resp_var_j.R

View workflow job for this annotation

GitHub Actions / Linter 🦸‍♀️ / Lint R code 🧶

file=R/a_freq_resp_var_j.R,line=181,col=1,[trailing_whitespace_linter] Remove trailing whitespace.
# for combined facet, denom_df value for the treatment group needs update
denom_df <- upd_denom_df_combo(
denom_df,

Check warning on line 184 in R/a_freq_resp_var_j.R

View workflow job for this annotation

GitHub Actions / Linter 🦸‍♀️ / Lint R code 🧶

file=R/a_freq_resp_var_j.R,line=184,col=8,[indentation_linter] Hanging indent should be 37 spaces but is 8 spaces.
trt_var,
cur_trt_grp,
.spl_context)
Expand All @@ -199,10 +205,12 @@
weights_method = weights_method
)
x_stat <- rslt[["rr_ci_3d"]]$Y
# use .formats if provided, otherwise default to rr format
fmt <- if (is.null(.formats)) jjcsformat_xx("xx.x (xx.x, xx.x)") else .formats
rslt <- rcell(
x_stat,
format = jjcsformat_xx("xx.x (xx.x, xx.x)"),
format_na_str = rep("NA", 3)
format = fmt,
format_na_str = na_str
)
}

Expand Down
6 changes: 6 additions & 0 deletions man/a_freq_resp_var_j.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading