R: Use greek letters as coefficient names in the output of htmlreg()

336 views Asked by At

I would like to build a html table with html reg which includes mathematical symbols as custom coefficient names.

A mock example:

library(texreg)
set.seed(20)
q <- seq(from=0, to=20, by=0.1)
y <- 500 + 0.4 * (q-10)^3
noise <- rnorm(length(q), mean=10, sd=80)
noisy.y <- y + noise
lin<-lm(noisy.y ~ q )
quad<-lm(noisy.y ~ q + I(q^2) )
cub<-lm(noisy.y ~ q+ I(q^2) + I(q^3))

htmlreg(list(lin,quad,cub), custom.model.names = c("Linear","Quadratic","Cubic"), 
custom.coef.names = c("const","\\&beta_1","\\&beta_2","\\&beta_3"))
1

There are 1 answers

0
Fr. On BEST ANSWER

I assume that you are using the texreg package.

The HTML code for \beta is different from what it is in LaTeX.

htmlreg(list(lin,quad,cub), custom.model.names = c("Linear","Quadratic","Cubic"), 
        custom.coef.names = c("const",
                              "&Beta;<sub>1</sub>",
                              "&Beta;<sub>2</sub>",
                              "&Beta;<sub>3</sub>"))