fsmry.dmgrph: Generating summary statistics of data in a data frame by a...

View source: R/fsmry.dmgrph.R

fsmry.dmgrphR Documentation

Generating summary statistics of data in a data frame by a categorical variable

Description

Generating summary statistics of data in a data frame by a categorical variable

Usage

fsmry.dmgrph(dat = dat.work, vars = vars, vars.cat = vars.cat,
  vars.chisq = rep(0, length(vars)), by = "BMI.cat", all = T,
  markdown = T, IQR = T)

Arguments

dat

A data frame.

vars

A vector of variable names to be analyzed.

vars.cat

A vector of indicators of whether the variable is categorical or not

vars.chisq

A vector of indicators specifying for which variables the chi-square test should be used

by

A categorial variable name the vars will be summarized by.

all

An indicator of whether to provide the overall summary statistics of the data

markdown

An indicator of whether to generate the summary table by bolding the variable names using markdown language.

IQR

An indicator of whether to summarize the continuous using IQR (default) or range.

Value

Summary statistics of each variable in a data frame and by grp using parametric and non-parametric methods.

Examples

set.seed(16)
dat.work <- data.frame(ht = c(rnorm(10, mean=1.72, sd=0.1), rnorm(10, mean=1.65, sd=0.1)),
                       wt = c(rnorm(10, mean=70, sd=10), rnorm(10, mean=60, sd=10)),
                       sex = factor(rep(c("Female", "Male", "Female", "Male"), c(2,8,6,4))),
                       group = factor(rep(c("grp1", "grp2"), each=10)))
fsmry.dmgrph(dat = dat.work,
             vars = c("ht", "wt", "sex"),
             vars.cat = c(0, 0, 1),
             by =  "group")

xkzhou/BTKR documentation built on Feb. 1, 2023, 1:14 a.m.