【问题标题】:How to append notes to a latex table in Hmisc in R?如何在 R 中的 Hmisc 中将注释附加到乳胶表?
【发布时间】:2014-01-07 13:42:19
【问题描述】:

一种不优雅的方法是在注释文本中添加几行 tex 代码。

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

【问题讨论】:

  • 这不是insert.bottom 参数应该做的吗?
  • @joemienko 这非常接近,但insert.bottom.width 仅适用于longtable,因此,便笺将比表格更宽。

标签: r latex hmisc


【解决方案1】:

有一种方法不在 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 中使用标题和标签参数

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")

【讨论】:

    猜你喜欢
    • 2014-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-14
    • 1970-01-01
    • 1970-01-01
    • 2015-10-08
    相关资源
    最近更新 更多