我正在使用stargazer
将回归结果从r
输出到latex
。当我在乳胶中运行输出时,我看到了结果,但得到了很多Package array error
个。这是我的代码。在R中,我使用stargazer
如下:
stargazer(fe1, fe2, fe3,
title="Between regression",
align=TRUE,
df = FALSE,
dep.var.labels=c('depLabel'),
covariate.labels = c('1st', '2nd', '3rd', '4th') )
这会在latex
中产生许多错误,如下所示:
Package array Error: Illegal pream-token (D): `c' used. ...5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
Package array Error: Illegal pream-token (.): `c' used. ...5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
Package array Error: Illegal pream-token (-3): `c' used. ...5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
以及许多Missing $ inserted
错误。是否有任何包装需要添加到我的乳胶前言中?或者其他常见的解决方法?
修改以下是dput
fe1
的最后一行:
"31495", "31496", "31497", "31498", "31499", "31500"), class = c("pindex",
"data.frame"))), assign = c(0L, 1L, 1L), args = structure(list(
model = "within", effect = "time", random.method = "swar",
random.dfcor = NULL, inst.method = "bvk"), .Names = c("model",
"effect", "random.method", "random.dfcor", "inst.method")), aliased = structure(c(FALSE,
FALSE), .Names = c("X1Dq", "X1DT")), call = plm(formula = Y1 ~
X1, data = pdata1, effect = "time", model = "within")), .Names = c("coefficients",
"vcov", "residuals", "df.residual", "formula", "model", "assign",
"args", "aliased", "call"), class = c("plm", "panelmodel"))
答案 0 :(得分:3)
我找到了通过挖掘documentation来解决问题的方法:确保在乳胶前言中添加\usepackage{dcolumn}
。然后,在编写乳胶时,我不会遇到任何错误。
答案 1 :(得分:3)
由于我刚经历过同一问题,因此我想使@splinter的答案更明确。要在使用knitr / rmarkdown时将其添加到乳胶序言中,您需要将其放在此处:
---
title: "Project Tables"
author: "Kelsey E. Gonzalez"
date: "January 20, 2020"
header-includes:
- \usepackage{dcolumn}
output:
pdf_document: default
---
header-includes是一个不常用的可选设置,但将强制由乳胶加载dcolumn。