Function huxreg
in the huxtable
package automatically recognises numbers and formats them as predefined in the number_format = "%.3f"
option. I would like to report confidence intervals in my report and use the CI95: prefix. Unfortunately, the numerical part of the prefix is automatically formatted and the prefix looks like CI95.000.
Let's consider following example:
library(huxtable)
data <- data.frame(y = rnorm(10), x=rnorm(10))
fit <- lm(y ~ x, data)
huxreg(fit,
ci_level = 0.95,
error_pos = "below",
error_format = "CI95: ({conf.low}, {conf.high})" )
Is there any way to get the CI95 as intended? I have tried numeric to character conversions with no success. Thanks!
While not optimal, you could perhaps add , number_format = c("%.3f", "%.3g", "%.3f", "%.3g")
to your huxreg
call to specifically affect the formatting of the CI95 rows of your table (or save the output as an object and then modify the attribute elements that define the formatting of those lines, e.g. do attr(res, "number_format")[[13]] <- "%.3g"
, etc.). Other than that I could only think of somehow modifying the underlying glue
transformer that transforms the entire string and leaves all numeric elements with the same formatting.