在R中创建表1

时间:2012-09-21 15:31:37

标签: r datatable hmisc

有谁知道如何使用R在临床试卷中创建典型的表格1?更具体地说,我需要报告连续变量的均值/ SD和整个总体的分类变量的计数/百分比,以及由分类变量定义的每个组。我还想报告组间差异的p值。我看到人们只为连续变量做了这个,但对于分类变量却没有。任何帮助是极大的赞赏。

1 个答案:

答案 0 :(得分:2)

第一部分,部分回答:

require(Hmisc)
latex(describe(DFnew[1:400, c("Sex", "GGT")], descript='Table1: Descriptive Statistics')

你会在Harrell's various webpages dedicated to reproducible research.找到更多有用的例子。特别是你应该看看Harrell monograph describing the tools he has constructed.中的第30页(表9)。这基本上就是你所要求的。

enter image description here