简体   繁体   English

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

[英]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.

相关问题 如何从R中的列中删除脚注引用? - How to remove footnote references from a column in R? R的Huxtable包:如何为huxtables的caption()和footnote()设置font_size()? - Huxtable package for R: How to set font_size() for caption() and footnote() for huxtables? 如何在 R 中将 huxtable 保存为 png 文件 - How can I save a huxtable as png file in R 如何在rmarkdown中使用bookdown创建一个huxtable表标题? - How do I create a huxtable table caption using bookdown in rmarkdown? 从LaTeX中R的xtable()表输出中删除其他脚注 - Remove additional footnote from R's xtable() table output in LaTeX 如果您使用的是forestplot R包,如何添加脚注? - How do you add a footnote if you are using the forestplot R package? 如何使用 R 中的“huxtable”库为表格中所需的单元格着色。 哪种方式更优雅? - How to color the required cells in the table using "huxtable" library in R. Which is more elegant way to do it? 如何使用huxtable()在小标题中使用回归模型的打印列表列 - How do I use print list-column of regression models in a tibble using huxtable() 如何告诉R从相关计算中删除异常值? - How do I tell R to remove the outlier from a correlation calculation? 如何从 R 中的字符 function 中删除尾随零? - How do I remove trailing zeros from a character function in R?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM