小编Dan*_*lle的帖子

使用Stata的esttab,将美元符号添加到单元格格式,导出到Latex

我的顾问要我在汇总统计表中添加美元符号.我生成这个表并使用Stata的esttab命令将其导出到Latex.

我需要1)在一些结果单元格中添加美元符号(不是全部)和2)确保Latex可以处理美元符号.

我认为2可以使用替换选项完成,但我无法弄清楚如何做1.这是我试图用来解决这个问题的一些最小代码.

sysuse auto, clear

estpost summarize price mpg weight length if foreign==0
est store A
estpost summarize price mpg weight length if foreign==1
est store B

esttab A B  using $root/Outputs/test.tex, replace ///  //a file path on my machine
cells("mean (fmt(%9.0fc %9.2fc %9.0fc))" "sd(par fmt(%9.0fc %9.2fc %9.0fc))") ///
mtitle("Domestic" "Foreign") ///
mgroups("Type", pattern(1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat( \cmidrule(lr){@span})) ///
nonumber booktabs f label  collabels(none)

eststo clear
Run Code Online (Sandbox Code Playgroud)

这会产生:

                    &\multicolumn{2}{c}{Type} \\\cmidrule(lr){2-3}
                    &\multicolumn{1}{c}{Domestic}&\multicolumn{1}{c}{Foreign}\\
\midrule
Price               &       6,072&       6,385\\
                    &     (3,097)& …
Run Code Online (Sandbox Code Playgroud)

latex stata

7
推荐指数
1
解决办法
491
查看次数

lapply函数在igraph中查找邻居(当找不到所有节点时)

我正在尝试为节点列表创建网络邻居的数据集.我虽然可以使用lapply函数来执行此操作,其中我使用neighbors命令.作为一个额外的复杂功能,我的一些查找节点不在图中,但无论如何我无法使其工作.

这是一个例子:

edgelist <- read.table(text = "
A B
B C
C D
D E
C F
F G")  

testlist <- read.table(text = "
A
H
C
D
J")  

testlist2 <- read.table(text = "
A
C
B
D
E") 

library(igraph)
graph <- graph.data.frame(edgelist)
str(graph)

neighbors<- lapply(testlist2, function(p) {  #Each pledge_id
  temp=neighbors(graph,p)  #Find all the neighbors for that pledge 
  return(temp)
})

neighbors<- lapply(testlist, function(p) {  #Each pledge_id
  temp=neighbors(graph,p)  #Find all the neighbors for that pledge 
  return(temp)
})
Run Code Online (Sandbox Code Playgroud)

不幸的是,这两种情况下都会返回hogwash.我错过了什么?

我想要的输出将是这样的:

lookupnode neighbor …
Run Code Online (Sandbox Code Playgroud)

r igraph

1
推荐指数
1
解决办法
421
查看次数

标签 统计

igraph ×1

latex ×1

r ×1

stata ×1