【发布时间】:2021-07-02 02:02:35
【问题描述】:
我正在使用 RMarkdown 并使用 gt 包创建报告。在我编写文档之前,图形输出显示了 2 个部分:“R Console”和“shiny.tag.list”。虽然“shiny.tag.list”有表格,但 R 控制台是我编织文档后出现的内容,“min 没有非缺失参数;将 Infno 非缺失参数返回给 max;返回 -Inf”。我如何让它显示表格?有没有办法解决 R 控制台 cmets,使其不会出现?
附言。针织输出在 Microsoft Word 中。
gt_tbl <-
df_tbl %>%
gt(rowname_col="date")
# removes date so you can add a line alignment for that column
gt_tbl <-
gt_tbl %>%
tab_stubhead(label="date")
# adds the line alignment + new label for column you just took out name for
gt_tbl <-
gt_tbl %>%
tab_header(
title=md("**Weekly Screener Report**"),
subtitle= {current_range}) %>%
tab_style(
style=list(
cell_fill(color="light blue"),
cell_text(weight="bold")
),
locations = cells_body(
columns=vars(week_total)
)
)
# md("**text**") bolds "text"
# tab_style() adds color where you want it, can be done to rows as well
# tab_header is for title and subtitle
# Create 2 row groups w/ 'tab_row_group()' function
# Group the rows in opposite order you want to see it in
gt_tbl <-
gt_tbl %>%
tab_row_group(
group="current",
rows= 5:8
) %>%
tab_row_group(
group="former",
rows= 1:4
)
# view table
gt_tbl
【问题讨论】:
-
一个可重复的例子可以帮助你更好地理解你的问题
标签: r r-markdown