statsBin: Calculates summary statistics.

Description Usage Arguments Details Value See Also

Description

Takes the result of a code_function, e.g. codeSingle(), and calculates summary values, for direct plotting by a plotFunction, e.g. plotBar()

Usage

1
2
3
4
  statsBin(surveyorCode, ylabel = "Respondents",
    stats_method = "statsBin", convert_to_percent = FALSE,
    formatter = ifelse(convert_to_percent, "formatPercent", "format"),
    autosort = FALSE, ...)

Arguments

surveyorCode

An object of class "surveyorCode". This is a list with the first element being a data frame with four columns: cbreak, question, response, weight

ylabel

The label to print on y-axis of plots; used downstream

stats_method

A character vector describing name of stats method. Used for audit trail

convert_to_percent

If true, will express results as fractions, rather than counts

autosort

Logical. If TRUE, sorts questions in order of response

...

Passed to as.surveyorStats

formatter

A formatting function, such as formatPercent

Details

The results are sorted in descending order of value, and "response" is coerced into an ordered factor (unless "response" is already an ordered factor).

Value

A data frame with three columns: cbreak, variable, value

See Also

For an overview of the surveyor package surveyor

Other statsFunctions: statsBinPercent, statsCentral, statsCount, statsGuess, statsMean, statsMedian, statsNetScore, statsRank, statsSum, statsText


andrie/surveyor documentation built on May 10, 2019, 11:21 a.m.