如何在R中的Hmisc中将注释附加到乳胶表中?

时间:2013-12-19 05:27:15

标签: r latex hmisc

一种不雅的方式就是用注释文本添加tex代码行。

但是,在R中的latex包的Hmisc函数中有更原生的方式做笔记吗?

1 个答案:

答案 0 :(得分:0)

有一种方法不在Hmisc中,而是使用starpolishr包,

install.packages("devtools")
library(devtools)
install_github("ChandlerLutz/starpolishr");library(starpolishr)

插入带有标题包

的脚注
la<-latex(mtcars[1:2,1:5],file="example.tex",caption = "table using caption",
    where="!htbp") 
file0<-readLines("example.tex") 
file0<-star_notes_tex(file0, note = "file using caption*") 
cat(file0, file = paste0(getwd(),"/file0.tex"),sep="\n")

使用threeparttable

插入脚注

注意,您必须在Hmisc :: latex

中使用caption和label参数
mt <- mtcars[1:2,1:5]
mt[1,1]<-paste0(mt[1,1],"\\tnote{*}")
la<-latex(mt,file="example1.tex",label=" ",caption="table using threeparttable",
    where="!htbp") 
file1<-readLines("example1.tex") 
file1<-star_notes_tex(file1, note.type = "threeparttable",
note = "* notes with threeparttable : For this example you must use both label and caption, the
 threepartable code is meant to be used with tables generated by
 stargazer where a row with label is present. Otherwise the threepart table 
 argument is badly positionned.")
cat(file1, file = paste0(getwd(),"/file1.tex"),sep="\n")

footnotes