diff --git a/vignettes/tern_functions_guide.Rmd b/vignettes/tern_functions_guide.Rmd index 929c106ff2..9ca00049cf 100644 --- a/vignettes/tern_functions_guide.Rmd +++ b/vignettes/tern_functions_guide.Rmd @@ -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) ```