微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 R 中的 huxtable 保存为 LaTex 格式的文件

如何解决将 R 中的 huxtable 保存为 LaTex 格式的文件

如何将 huxtable 保存到 LaTeX (.tex) 格式的文件中?我确实找到了 this code 将 LaTeX 表打印到控制台:

library(huxtable)
ht <- huxtable(
        a = 1:3,b = letters[1:3]
      )
print_latex(ht)

huxtable 包是否具有将表保存到磁盘的本机方式,或者我们是否需要解决方法

解决方法

可能还有其他方法,但使用 capture.output 有效 -

library(huxtable)
capture.output(print_latex(ht),file = 'output.tex')
,

huxtable 包有一个函数可以做到这一点:pub fn generate_random_guid() -> String { use std::fmt::Write; let my_uuid: Uuid = Uuid::new_v4(); let array_bytes = my_uuid.as_bytes(); let mut rand_id = String::with_capacity(18); rand_id.push_str("0x"); for byte in &array_bytes[..8] { write!(&mut rand_id,"{:02X}",byte).unwrap(); } rand_id }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。