我想要多行自定义模型名称screenreg
。我试过了\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"))
但这失败了:
========================================================
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
我希望输出头看起来像这样:
========================================================
Length of sepal Width of sepal
in cm in cm
--------------------------------------------------------
custom.model.names
不幸的是不接受矩阵。
因此,
我想texreg
在我尝试过的地方
texreg(mget(ls(pattern="lfit")),
custom.model.names=c("Length of sepal\\\\in cm",
"Width of sepal\\\\in cm"),
dcolumn=TRUE)
但这完全失败了,因为它产生
& \multicolumn{1}{c}{Length of sepal\\in cm} & \multicolumn{1}{c}{Width of sepal\\in cm} \\
而不是需要
& \multicolumn{1}{c}{Length of sepal} & \multicolumn{1}{c}{Length of petal} \\
& \multicolumn{1}{c}{in cm} & \multicolumn{1}{c}{in cm} \\
想要的texreg
结果: