sumstat: Summary Statistics

Description Usage Arguments Examples

View source: R/UTL.sumstat.r

Description

This function works together with data.table to generate summary statistics information.

Usage

1
2
sumstat(a, n = F, mu = F, s = F, q = NULL, q.type = 8, mdn = F,
  mnm = F, sem = F, round.N = 3)

Arguments

a

A Variable

n

Whether the number of non-missing/null values will be displayed

mu

Whether the value of mean will be calculated

s

Whether the value of standard deviation will be calculated

q

A list of quantiles

round.N

Round digits

type

Quantile type

Examples

1
2
3
4
5
6
7
8
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
dt[, as.list(unlist(lapply(.SD, sumstat, n=F, mu=T, s=T, q=c(.25, .5, .75)))), by=.(grp, time)]

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