Issue description
In theory, attrition diagrams accommodate arbitrary column names for value_column_name, so long as they are valid columns in the attrition table object. But string formatting prevents attrition diagrams from printing percentages, even when they are the pre-calculated format from the get_attrition function.
Steps to reproduce the issue
Minimal reproducible code below. Note that changing value_column_name from "Remaining %" to "Remaining N" produces a diagram as expected.
ad <- visR::get_attrition(visR::adtte,
criteria_descriptions = c("1. Not in Placebo Group",
"2. Be 75 years of age or older.",
"3. White",
"4. Female"),
criteria_conditions = c("TRTP != 'Placebo'",
"AGE >= 75",
"RACE=='WHITE'",
"SEX=='F'"),
subject_column_name = "USUBJID")
visR::visr(ad, description_column_name = "Criteria", value_column_name = "Remaining %")
What's the expected result?
An attrition diagram that reports included and excluded patients in terms of percentage of the initial study population.
What's the actual result?
No diagram is produced, and I get the following error message:
Error: Problem with `mutate()` column `label`.
ℹ `label = sprintf("%s\nN = %d", label, get(value_column_name))`.
x invalid format '%d'; use format %f, %e, %g or %a for numeric objects
ℹ The error occurred in row 2.
Additional details / screenshot

I believe the problem arises from applying the following sprintf within the .get_labels internal:
dplyr::mutate(label = sprintf("%s\nN = %d", label, get(value_column_name)))
Solution ideas
- Allow users to specify their own
sprintf template to visr.attrition , perhaps with "%s\nN = %d" as the default
- Within
.get_labels, check whether value_column_name contains integers, and apply N-based labelling if so and %-based labelling (e.g., "%s\n%.2f%%") otherwise
Issue description
In theory, attrition diagrams accommodate arbitrary column names for
value_column_name, so long as they are valid columns in the attrition table object. But string formatting prevents attrition diagrams from printing percentages, even when they are the pre-calculated format from theget_attritionfunction.Steps to reproduce the issue
Minimal reproducible code below. Note that changing
value_column_namefrom"Remaining %"to"Remaining N"produces a diagram as expected.What's the expected result?
An attrition diagram that reports included and excluded patients in terms of percentage of the initial study population.
What's the actual result?
No diagram is produced, and I get the following error message:
Additional details / screenshot
I believe the problem arises from applying the following
sprintfwithin the.get_labelsinternal:Solution ideas
sprintftemplate tovisr.attrition, perhaps with"%s\nN = %d"as the default.get_labels, check whethervalue_column_namecontains integers, and apply N-based labelling if so and %-based labelling (e.g.,"%s\n%.2f%%") otherwise