首页 > 解决方案 > library(table1) :将质量最好的表提取为单词

问题描述

我已经为我的描述表使用了库表 1。我的问题是关于导出 Word 文档的输出表。我不知道如何提取质量最好的表。(我没有任何问题可以编织到 HTML,但我在导出 word 和 PDF 表时遇到问题。)我的 bookdown 设置如下面所述:

---
title: "Untitled"
author: "Marjan"
date: "3/29/2021"
output:
  pdf_document:
    toc: yes
  word_document:
    toc: yes
  html_document:
    toc: yes
    toc_float:
      collapsed: no
      smooth_scroll: no
---

这是我的代码的一个子集:

```{r echo = FALSE, results = FALSE, message = FALSE, warning = FALSE, error = FALSE}
table1(~ factor(sex ) + age + factor(race) + education +factor(marital) + bmi + factor(smoke) + activity +factor(dominant)+allgrip
       | cancer, data=main)

label(main$sex)<- "Sex % (N)"
label(main$age)<- "Age"
label(main$race)<- "Race(N)"
label(main$education) <- "Education % (N)"
label(main$marital)<- "Marital status % (N)"
label(main$bmi)<- "Body mass index (kg/m2)(SD)"
label(main$smoke)<- "Current daily smoker % (N)"
label(main$activity) <- " Work activity"
label(main$dominant)<- "Dominant hand % (N)"
label(main$allgrip) <- "Grip Strength/Kg"
table1(~ sex + age + race + education +marital
       +bmi + smoke + activity +dominant+allgrip 
       | cancer, data=main,overall=F, topclass="Rtable1-zebra",render.missing=NULL)

knitr::opts_chunk$set(echo = TRUE)
```

在此处输入图像描述

标签: htmlrpdfoutputword

解决方案


推荐阅读