这里的初学者问题很抱歉,如果这是一个明显的错误。我使用summary_table
R 包qwraps2中的函数生成了一个汇总统计表。当我在 markdown 中运行代码时,它会按预期生成表格,但是当我尝试将 rmd 编织到 html 以在 rpubs 上发布时,它看起来如下所示:
## |Summary Statistics |ESS (N = 73) |
## |:--------------------------------|:-------------------------------|
## |**Alcohol drunk at the weekend** | |
## | variable |interval |
等等...
(该表应类似于这些表:https ://cran.r-project.org/web/packages/qwraps2/vignettes/summary-statistics.html )
我知道我已经将 qwraps2_markup 编码为等于 'markdown' 但我不确定如何在不这样做的情况下创建同一个表。
```{r}
options(qwraps2_markup = 'markdown')
our_summary <-
list("Alcohol drunk at the weekend" =
list("variable" =~ c("interval"),
"min" = ~ min(ESS$alcwknd),
"median" = ~ median(ESS$alcwknd),
"max" = ~ max(ESS$alcwknd),
"mean (sd)" = ~ qwraps2::mean_sd(ESS$cgtsday)),
"Cigarettes smoked" =
list("variable" =~ c("interval"),
"min" = ~ min(ESS$cgtsday),
"median" = ~ median(ESS$cgtsday),
"max" = ~ max(ESS$cgtsday),
"mean (sd)" = ~ qwraps2::mean_sd(ESS$cgtsday)),
"Age" =
list("variable" =~ c("Interval"),
"min" = ~ min(ESS$agea),
"median" = ~ median(ESS$agea),
"max" = ~ max(ESS$agea),
"mean (sd)" = ~ qwraps2::mean_sd(ESS$agea)),
"Time helping others" =
list("variable" =~ c("Ratio"),
"mode" =~ time_mode),
"Felt Depressed" =
list("variable" =~ c("Ordinal"),
"mode" =~ dpr_mode),
"Main Activity" =
list("variable" =~ c("Categorical"),
"mode" =~ act_mode))
tab <- summary_table(ESS, our_summary)
print(tab, rtitle = "Summary Statistics")
```
任何帮助都非常感谢,并提前感谢。