繁体   English   中英

如何从 R 中的 huxtable 中删除脚注?

[英]How do I remove a footnote from a huxtable in R?

一旦通过add_footnote设置了脚注,似乎就很难再次摆脱它。

library(magrittr)
library(huxtable)

jams <- hux(
  Type  = c("Strawberry", "Raspberry", "Plum"),
  Price = c(1.90, 2.10, 1.80)
) %>% add_footnote("Tasty stuff!")

我尝试过的一种解决方案是:

head(jams, -1)

不幸的是,huxtable 底部的线仍然存在。 我想要的是一个返回 huxtable 的解决方案,就好像脚注从未设置过一样。

编辑:下面的代码也将删除该行:

jams <- head(jams, -1)
attributes(jams)$tb_borders$thickness[nrow(attributes(jams)$tb_borders$thickness), ] <- 0

不过,我不确定这有多强大。

编辑:一个问题是,如果您使用它来删除从未设置的脚注,那么您将删除一行数据。

如果想去掉边框,就用相关的function:

jams <- hux(
  Type  = c("Strawberry", "Raspberry", "Plum"),
  Price = c(1.90, 2.10, 1.80)
) %>% add_footnote("Tasty stuff!")

head(jams, -1) %>% set_bottom_border(final(1), everywhere, 0)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM