【问题标题】:How do I remove a footnote from a huxtable in R?如何从 R 中的 huxtable 中删除脚注?
【发布时间】:2022-08-02 15:20:10
【问题描述】:

一旦通过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

我不确定这有多强大。

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

    标签: r huxtable


    【解决方案1】:

    如果你想摆脱边框,只需使用相关功能:

    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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-19
      • 1970-01-01
      • 2019-07-04
      • 2016-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多