univ: Univariable Table

Description Usage Arguments Details Author(s) Examples

Description

Similar to the QHS SAS macro, provides a simple summary of numerical variables

Usage

1
2
univ(data, vars, byVar, alpha = 0.05, test = c("t.test", "aov",
  "wilcox.test", "kruskal.test"), test.args = NULL)

Arguments

data

A ccf.df or data.frame containing the variables in vars and byVar.

vars

Character vector naming the variables in data to be summarized.

byVar

A categorical variables giving groups by which statistics should be computed.

alpha

significance level for determining the confidence limits.

test

The test to use for comparing between groups. Currently limited to t-test and ANOVA (parametric tests).

test.args

a list of additional arguments to pass to the function in test.

Details

Statistics available in univ, and the calls to get them are:

  1. nnumber of non-missing values.

  2. missingnumber of missing values

  3. meanarithmetic mean

  4. medianmedian value

  5. sdstandard deviation

  6. lcllower confidence limit

  7. uclupper confidence limit

  8. minminimum value

  9. maxmaximum value

  10. p2525th percentile

  11. p7575th percentile

  12. cvcoefficient of variation

univ does not perform any kind of inference on the varaibles supplied in the argument. It returns only summary statistics. If comparisons are desired, try using conttable. Confidence limits are determined using the t-distribution.

Author(s)

Benjamin Nutter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
data(Delivery)
#Read in the delivery dataset from the CCFmisc library
#use labelVector package to label variables in univariate tables
Delivery$maternal.age <- 
  labelVector::set_label(Delivery$maternal.age, "Maternal Age")
Delivery$ga.weeks <- 
  labelVector::set_label(Delivery$ga.weeks, "Gestation weeks")
Delivery$wt.gram <- 
  labelVector::set_label(Delivery$wt.gram, "Weight (g)")


#a univariate table of the variables maternal age,
#ga.weeks and wt.grams.  The object resulting
#from univ() can be used in other functions to create html or
#LaTeX tables.

uni <- univ(Delivery,
            vars=c("maternal.age", "ga.weeks", "wt.gram"))

#a univariate table of the variables maternal age,
#ga.weeks and wt.grams by delivery.type.  The object resulting
#from univ() can be used in other functions to create html or
#LaTeX tables.

deliv.uni <- univ(Delivery,
                  vars=c("maternal.age", "ga.weeks", "wt.gram"),
                  byVar="delivery.type")

#if you want to take advantage of the confidence interval
#output from univ() different alpha levels can be set
#by the alpha= argument.

deliv_99.uni <- univ(Delivery,
                     vars=c("maternal.age", "ga.weeks", "wt.gram"),
                     byVar="delivery.type",
                     alpha=0.01)

lazyWeave documentation built on May 2, 2019, 12:35 p.m.