twotoone: Two to one (Table re-formating)

Description Usage Arguments Examples

View source: R/TABLE.twotoone.r

Description

This function combines two elements into one in a format as "Mean (SD)". It converts the outputs of sumstat to a simplified format, which is ready for publishing through markdown.

Usage

1

Arguments

a

The input should be a summary table, whose columns are the stratifying groups and rows are pairs of variablew in the format of "variable.Mean", "variable.SD"...etc.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(data.table)
library(ifaR.handtool)
dt<-data.table(grp=rep(c("Control", "Treatment"), each=50),
               time=rep(c("Base", "Follow", "Base", "Follow"), each=25),
               age=rnorm(100, mean=65, sd=10),bmi=rnorm(100, mean=28, sd=4),
               leanmass=rnorm(100, mean=65, sd=6))
dt$leanmass[95]<-NA

tab1<-sumtbl(dt, c("age", "bmi", "leanmass"), c("grp", "time"), n=F, mu=T, s=T, q=NULL)
twotoone(tab1)

haozhu233/ifaR.handtools documentation built on May 17, 2019, 2:30 p.m.