我正在尝试使用 输出一个相当长的gt表gtsave。它不断被截断,最后几列丢失。滚动条也会显示在输出的图像中。
这是输出的表:
我希望它看起来像我的 5% 变化表,如下所示:
这是我的两个表的代码(包括 R Markdown 标头):
3%表
{r hotspot 3% 100 coverage reads table, fig.dim = c(12, 6)}
setwd(output_hotspot)
hotspot_3pct_table <- hotspot_3pct_longer %>%
ungroup() %>%
gt() %>%
tab_header(title = "Variation Across Lots at Select Base Pairs", subtitle = paste0("At least 100 coverage reads with at least 3% variation")) %>%
cols_label(
lot = "Lot"
) %>%
fmt_number(columns = 2:24, decimals = 2) %>%
fmt_missing(columns = everything(), missing_text = "--") %>%
tab_source_note(source_note = paste0("Dash …Run Code Online (Sandbox Code Playgroud) 我有一个如下所示的数据集:
data <- data.frame(Subject = c("A","B","C"),
Col1 = c("Yes", "Yes", "No"),
Col2 = c("Yes", "Yes", "Yes"),
Col3 = c("Yes", "Yes", "Yes")
)
print(data)
Subject Col1 Col2 Col3
1 A Yes Yes Yes
2 B Yes Yes Yes
3 C No Yes Yes
Run Code Online (Sandbox Code Playgroud)
我想总结是否所有列都等于“是”。如果是,则新列为“是”,如果其中一列为NA“否”,则摘要列为“否”。
我当前的代码看起来像这样,但我觉得有一个更简单的方法:
data %>%
group_by(Subject) %>%
summarize(Summary = case_when(
Col1 == "Yes & Col2 == "Yes & Col3 == "Yes ~ "Yes",
Col1 != "Yes & Col2 != "Yes & Col3 != "Yes ~ "No",
TRUE …Run Code Online (Sandbox Code Playgroud)