freq_mean: Run a mean in frequency form for a single variable.

Description Usage Arguments Value Examples

View source: R/means.R

Description

Run a mean in frequency form for a single variable.

Usage

1
freq_mean(dataset, variable, nas = TRUE, wt = NULL, prompt = F)

Arguments

dataset

A dataframe.

variable

The unquoted name of a variable in the dataframe.

wt

The unquoted name of a weighting variable in the dataframe.

prompt

Boolean, whether or not to include the prompt in the dataframe.

Value

A dataframe with the variable name, prompt, values, labels, counts, and means.

Examples

1
2
3
4
5
6
7
df <- data.frame(
  a = c(1, 2, 2, 3, 4, 2, NA),
  weights = c(0.9, 0.9, 1.1, 1.1, 1, 1, 1)
)

freq_mean(df, a)
freq_mean(df, a, wt = weights)

y2analytics/y2clerk documentation built on Feb. 21, 2018, 5:37 p.m.