使用pkg:stargazer为R更改表号

时间:2013-04-30 22:33:49

标签: r formatting stargazer

我正在尝试为我正在使用观星者写的一篇论文制作几张桌子,但每张桌子都出现了“表1:”,然后是我想要的标题。有没有办法阻止它打印,或者至少改变表号?

编辑:包的名称是stargazer,如上所述。这不是特定数据框架或回归的问题,而是我尝试创建的任何观星表。这是给我带来麻烦的代码 - 表格的标题打印为“表1:表1:在州内冲突中发生的战斗死亡比例(%)”

\begin{table}[htb] \centering  
  \caption{Table 1: Share of battle deaths that occurred in intrastate conflicts (\%)}  
  \label{}  
\footnotesize   

\begin{tabular}{@{\extracolsep{5pt}} c c }  
\\[-1.8ex]\hline  
\hline \\[-1.8ex]  
Years & Intrastate.conflict.battle.deaths \\  
\hline \\[-1.8ex]  
1950s & $8$ \\  
1960s & $29$ \\  
1970s & $43$ \\  
1980s & $67$ \\  
1990s & $92$ \\  
2000-2002 & $93$ \\  
\hline \\[-1.8ex]  
\normalsize  
\end{tabular}  
\end{table}

编辑编辑:抱歉,我是新手,我现在意识到代码的含义。

stargazer(battle_deaths, title = "Table 1: Share of battle deaths that occurred in intrastate conflicts (\%)", summary = FALSE, notes = "Source: Lacina and Gleiditsch 2005")

1 个答案:

答案 0 :(得分:1)

您知道stargazertitle个参数,对吧? (参见文档的第2页:http://cran.r-project.org/web/packages/stargazer/stargazer.pdf)。最小的例子:

library(ggplot2)
data(diamonds)
model <- lm(price ~ color + clarity,data=diamonds)
library(stargazer)
stargazer(model, title="Your title here")

不要手工编号。 LaTeX完全有能力为您做到这一点。