You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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
The text was updated successfully, but these errors were encountered:
I forgot to mention that if you indicate a preference between the solution ideas, I am willing to attempt the bugfix myself. But it does require a bit of a design decision about how prescriptive vs. flexible to make the visr.attrition method. Are you willing to assume the only column name options are "Remaining N" and "Remaining %"? For percentage reporting, are you willing to force users to report 2 and only 2 digits past the decimal point, or do you want them to be able to choose that for themselves?
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_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.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
sprintf
within the.get_labels
internal:Solution ideas
sprintf
template tovisr.attrition
, perhaps with"%s\nN = %d"
as the default.get_labels
, check whethervalue_column_name
contains integers, and apply N-based labelling if so and %-based labelling (e.g.,"%s\n%.2f%%"
) otherwiseThe text was updated successfully, but these errors were encountered: