So I am currently trying to make a summary statistics table using Table1 in R. Here is my code thus far:
my.render.cont <- function(x) {
with(stats.apply.rounding(stats.default(x), digits = 3),
c("", "Mean (SD)" = sprintf("%s (± %s)", MEAN, SD)))
}
my.render.cat <- function(x) {
c("", sapply(stats.default(x), function(y)
with(y, sprintf("%d (%0.0f %%)", FREQ, PCT))))
}
table1(~ fs_hm + finsecure + fs_vlow + zfinlit + parent_conf +
age + female,
render.continuous=my.render.cont, render.categorical = my.render.cat,
data = df)
My problem is that the variable "zfinlit" is standardized with mean 0 and unit SD. However, when table1 computes the mean the output in my table has close to ten zeroes followed by three integers rather than simply a zero. What it is doing is technically correct of course, but not how I want my table to look.
Is there a fix to this problem anyone knows of? I've read some of the documentation and other examples to no avail. Any help is greatly appreciated!