describers: A collection of functions to summarize vectors in matrix...

Description Usage Arguments Examples

Description

These functions work on character, numeric, or factor vectors. They are meant to make outputs easier to paste into table.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
meansd(numvar, na.rm = TRUE, varname = NULL, digits = 2)

nprops(catvar, digits = 1)

crosstab(var1, var2, digits = 2)

gmeans(numvar, catvar, digits = 2)

describe(..., outcome, data, headerRow = NULL, headerFrame = NULL,
  includeHeader = TRUE, deparse.level = 2, digits = 2)

Arguments

numvar

A numeric vector

na.rm

(default TRUE) whether to remove NA values when summarizing numeric values

varname

An optional character string for the name of the vector (defaults to object name)

digits

The number of significant digits to show

catvar

A factor vector (categorical)

var1

A character or numeric vector

var2

A second categorical variable for crosstabulation

...

Variables to describe by the outcome, can be verctors or unquoted names when the data argument is supplied

outcome

The comparison variable, divides the data into categories

data

A data.frame containing the comparison variables

headerRow

A character vector for each variable in ... that serves as the descriptive name in the table

headerFrame

A data.frame that relates or maps each variable name to its respective descriptive name

includeHeader

logical (default TRUE) indicating whether or not to add a header row to the table with group counts for the outcome variable

deparse.level

controls how the default dnn is constructed. See 'table'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(mtcars)

meansd(mtcars$mpg)
nprops(mtcars$gear)

with(mtcars, gmeans(mpg, am))

am <- plyr::mapvalues(mtcars$am, c(0, 1), c("Auto", "Manual"))
mtcars$vs1 <- plyr::mapvalues(mtcars$vs, c(0, 1), c("V Engine", "Straight"))

gmeans(mtcars$mpg, am)

crosstab(mtcars$vs1, am)

mtcars$cyl <- factor(mtcars$cyl)
describe(mpg, cyl, disp, outcome = am, data = mtcars)

LiNk-NY/describer documentation built on May 29, 2019, 5:57 p.m.