4

I want multiline custom model names in screenreg. I tried \n

lfit1 <- lm(Sepal.Length ~ Petal.Width, iris)
lfit2 <- lm(Sepal.Width ~ Petal.Width, iris)

library(texreg)
screenreg(mget(ls(pattern="lfit")),
          custom.model.names=c("Length of sepal\nin cm", 
                               "Width of sepal\nin cm"))

but this fails:

========================================================
             Length of sepal
in cm  Width of sepal
in cm
--------------------------------------------------------
(Intercept)    4.78 ***               3.31 ***          
              (0.07)                 (0.06)             
Petal.Width    0.89 ***              -0.21 ***          
              (0.05)                 (0.04)             
--------------------------------------------------------
R^2            0.67                   0.13              
Adj. R^2       0.67                   0.13              
Num. obs.    150                    150                 
RMSE           0.48                   0.41              
========================================================
  *** p < 0.001, ** p < 0.01, * p < 0.05

I want the output head to look like that:

========================================================
            Length of sepal         Width of sepal
            in cm                   in cm
--------------------------------------------------------

custom.model.names unfortunately won't accept matrices.

 

Accordingly, I'd like to achieve the same in texreg where I tried

texreg(mget(ls(pattern="lfit")),
       custom.model.names=c("Length of sepal\\\\in cm", 
                            "Width of sepal\\\\in cm"), 
       dcolumn=TRUE)

but this fails completely since it produces

& \multicolumn{1}{c}{Length of sepal\\in cm} & \multicolumn{1}{c}{Width of sepal\\in cm} \\

instead of needed

 & \multicolumn{1}{c}{Length of sepal} & \multicolumn{1}{c}{Length of petal} \\
 & \multicolumn{1}{c}{in cm} & \multicolumn{1}{c}{in cm} \\

Wanted texreg result:

enter image description here

jay.sf
  • 60,139
  • 8
  • 53
  • 110
  • 2
    `texreg` package author here. It's currently not possible. I would recommend submitting a feature request [here](https://github.com/leifeld/texreg/issues) (or even adding a pull request with suggested functionality if you are up for it). It's also related to [this issue](https://github.com/leifeld/texreg/issues/3), but not identical. – Philip Leifeld Apr 21 '19 at 23:33
  • 1
    Hi! was this implemented in an updated version? – Erdne Htábrob Mar 18 '21 at 10:56

0 Answers0