[英]How do I remove a footnote from a huxtable in R?
Once a footnote has been set via add_footnote
it seems like its hard to get rid of again.一旦通过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!")
One solution I tried is this:我尝试过的一种解决方案是:
head(jams, -1)
Unfortunately, the line at the bottom of the huxtable remains.不幸的是,huxtable 底部的线仍然存在。 What I would like is a solution which returns a huxtable as if the footnote had never been set.我想要的是一个返回 huxtable 的解决方案,就好像脚注从未设置过一样。
EDIT: The code below will also remove the line:编辑:下面的代码也将删除该行:
jams <- head(jams, -1)
attributes(jams)$tb_borders$thickness[nrow(attributes(jams)$tb_borders$thickness), ] <- 0
I'm not sure how robust this is though.不过,我不确定这有多强大。
EDIT: One issue is that if you use this to remove a footnote which was never set then you remove a line of data.编辑:一个问题是,如果您使用它来删除从未设置的脚注,那么您将删除一行数据。
If you want to get rid of the border, just use the relevant function:如果想去掉边框,就用相关的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.