gpt4 book ai didi

r - 如何在 R 中的 Hmisc 中将注释附加到 latex 表?

转载 作者:行者123 更新时间:2023-12-03 17:51:26 25 4
gpt4 key购买 nike

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

但是在 latex 中是否有更原生的做笔记的方式? Hmisc 的功能R中的包?

最佳答案

有一种方法不是在 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")

用三部分表插入脚注

注意,你必须在 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

关于r - 如何在 R 中的 Hmisc 中将注释附加到 latex 表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20674065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com