Skip to content

Commit

Permalink
Merge branch '1345_refactor_summarize_change@main' of github.com:insi…
Browse files Browse the repository at this point in the history
…ghtsengineering/tern into 1345_refactor_summarize_change@main
  • Loading branch information
Melkiades committed Nov 5, 2024
2 parents e4ccb53 + 383ccc2 commit 9c0db6c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions vignettes/tern_functions_guide.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ Adding a custom statistic (and custom format):
```{r}
# changing n count format and label and indentation
fix_layout %>%
summarize_change(
"CHG",
variables = list(value = "AVAL", baseline_flag = "ABLFLL"),
.stats = c("n", "my_stat" = function(df, ...) {
a <- mean(df$AVAL, na.rm = TRUE)
b <- list(...)$.N_row # It has access at all `?rtables::additional_fun_params`
a / b
}),
.formats = c("my_stat" = function(x, ...) sprintf("%.2f", x))
) %>%
build_table(dta_test)
summarize_change(
"CHG",
variables = list(value = "AVAL", baseline_flag = "ABLFLL"),
.stats = c("n", "my_stat" = function(df, ...) {
a <- mean(df$AVAL, na.rm = TRUE)
b <- list(...)$.N_row # It has access at all `?rtables::additional_fun_params`
a / b
}),
.formats = c("my_stat" = function(x, ...) sprintf("%.2f", x))
) %>%
build_table(dta_test)
```


Expand Down

0 comments on commit 9c0db6c

Please sign in to comment.