R中的乳胶输出

问题描述 投票:0回答:1

我正在使用包

stargazer
在一个独特的表格中表示一些回归输出。问题是它给了我一个 LATEX 输出(我是这方面的新手)

更好的解释

stargazer(reg_a, reg_b, reg_c,  reg_d, reg_e, align=TRUE)

它给了我这个作为输出

% Table created by stargazer v.5.2.3 by Marek Hlavac, Social Policy Institute. E-mail: marek.hlavac at gmail.com
% Date and time: ven, mar 17, 2023 - 16:11:49
% Requires LaTeX packages: dcolumn 
\begin{table}[!htbp] \centering 
  \caption{} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} } 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{4}{c}{\textit{Dependent variable:}} \\ 
\cline{2-5} 
\\[-1.8ex] & \multicolumn{4}{c}{log(tpens)} \\ 
\\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)}\\ 
\hline \\[-1.8ex] 
 sex & 0.265^{***} & 0.170^{***} & 0.171^{***} & 0.170^{***} \\ 
  & (0.010) & (0.010) & (0.010) & (0.010) \\ 
  & & & & \\ 
 eta & -0.003^{***} & -0.001 & -0.001^{*} & -0.001^{*} \\ 
  & (0.001) & (0.001) & (0.001) & (0.001) \\ 
  & & & & \\ 
 ireg & -0.008^{***} & -0.006^{***} & -0.005^{***} & -0.005^{***} \\ 
  & (0.001) & (0.001) & (0.001) & (0.001) \\ 
  & & & & \\ 
 studio\_lev2 & 0.129^{***} & 0.115^{***} & 0.114^{***} & 0.114^{***} \\ 
  & (0.014) & (0.013) & (0.013) & (0.013) \\ 
  & & & & \\ 
 studio\_lev3 & 0.422^{***} & 0.406^{***} & 0.403^{***} & 0.404^{***} \\ 
  & (0.022) & (0.021) & (0.021) & (0.021) \\ 
  & & & & \\ 
 type\_jobManager & 0.473^{***} & 0.426^{***} & 0.422^{***} & 0.422^{***} \\ 
  & (0.023) & (0.022) & (0.022) & (0.022) \\ 
  & & & & \\ 
 type\_jobMiddle-class\_worker & 0.204^{***} & 0.170^{***} & 0.166^{***} & 0.166^{***} \\ 
  & (0.014) & (0.014) & (0.014) & (0.014) \\ 
  & & & & \\ 
 type\_jobSelf-Employed & -0.134^{***} & -0.178^{***} & -0.182^{***} & -0.182^{***} \\ 
  & (0.013) & (0.012) & (0.012) & (0.012) \\ 
  & & & & \\ 
 sector & 0.049^{***} & 0.050^{***} & 0.050^{***} & 0.050^{***} \\ 
  & (0.005) & (0.004) & (0.004) & (0.004) \\ 
  & & & & \\ 
 acontrib &  & 0.016^{***} & 0.016^{***} & 0.016^{***} \\ 
  &  & (0.001) & (0.001) & (0.001) \\ 
  & & & & \\ 
 dislav &  &  & -0.088^{***} & -0.089^{***} \\ 
  &  &  & (0.016) & (0.017) \\ 
  & & & & \\ 
 nesplav &  &  &  & 0.003 \\ 
  &  &  &  & (0.009) \\ 
  & & & & \\ 
 Constant & 6.876^{***} & 6.191^{***} & 6.233^{***} & 6.229^{***} \\ 
  & (0.048) & (0.052) & (0.052) & (0.053) \\ 
  & & & & \\ 
\hline \\[-1.8ex] 
Observations & \multicolumn{1}{c}{5,936} & \multicolumn{1}{c}{5,812} & \multicolumn{1}{c}{5,812} & \multicolumn{1}{c}{5,812} \\ 
R$^{2}$ & \multicolumn{1}{c}{0.416} & \multicolumn{1}{c}{0.488} & \multicolumn{1}{c}{0.490} & \multicolumn{1}{c}{0.490} \\ 
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.415} & \multicolumn{1}{c}{0.487} & \multicolumn{1}{c}{0.489} & \multicolumn{1}{c}{0.489} \\ 
Residual Std. Error & \multicolumn{1}{c}{0.321 (df = 5926)} & \multicolumn{1}{c}{0.299 (df = 5801)} & \multicolumn{1}{c}{0.298 (df = 5800)} & \multicolumn{1}{c}{0.298 (df = 5799)} \\ 
F Statistic & \multicolumn{1}{c}{468.804$^{***}$ (df = 9; 5926)} & \multicolumn{1}{c}{552.450$^{***}$ (df = 10; 5801)} & \multicolumn{1}{c}{507.248$^{***}$ (df = 11; 5800)} & \multicolumn{1}{c}{464.915$^{***}$ (df = 12; 5799)} \\ 
\hline 
\hline \\[-1.8ex] 
\textit{Note:}  & \multicolumn{4}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
\end{tabular} 
\end{table} 

我已经尝试安装

Requires LaTeX packages: dcolumn 
但没有任何变化......我仍然得到这个代码作为输出

如何从这段代码中看到表格?

r datatable latex r-markdown output
1个回答
0
投票

观星者用乳胶代码创建了一个表格。因此,如果您想查看输出,您可以在代码块中创建一个带有

Rmarkdown
results = 'asis'
pdf 文档。这是一些使用内置数据集态度的可重现代码:

---
output: pdf_document
---

```{r, results='asis'}
library(stargazer)
stargazer(attitude)
```

输出:

© www.soinside.com 2019 - 2024. All rights reserved.