Closed billdenney closed 1 year ago
This is entirely reasonable. I try to avoid having too many options for special cases though to keep the interface manageable. You could always do something like this:
library(table1)
dat <- data.frame(x=factor(sample(LETTERS[1:4], 20, replace=T)))
dat <- dat[dat$x != "C",, drop=F]
special0handling <- function(x, ...) {
gsub("0 (0%)", "0", render.default(x, ...), fixed=TRUE)
}
table1(~ x, dat, render.categorical=special0handling)
I fully support not having too many options! (I share that opinion.) And, thanks for the method to handle it without changes.
As one last ask on the topic: Since "0" and "0%" are duplicate information, does it seem reasonable to change the default to just show "0"? (If not, no worries, and I'll use the suggested change.)
Like I said, I think it's entirely reasonable to just use "0" in these situation, but both approaches have their disadvantages in terms of consistency and aesthetics, in my opinion. Therefore, my personal opinion is that the suggestion doesn't provide enough value to warrant changing the default at this time. (In fact, at one point early on I did consider making "0" the default, but I decided against it in the end.) But, I'll admit that I do continue to think about exactly this issue.
All good. Thanks for the consideration.
Currently, when a value is zero for a count, it shows as "0 (0%)". Could there be an option to make it just show "0" without the percentage?