Freq: Frequency statistics.

View source: R/bruceR-stats_1_basic.R

FreqR Documentation

Frequency statistics.

Description

Frequency statistics.

Usage

Freq(x, varname, labels, sort = "", digits = 1, file = NULL)

Arguments

x

A vector of values (or a data frame).

varname

[Optional] Variable name, if x is a data frame.

labels

[Optional] A vector re-defining the labels of values.

sort

"" (default, sorted by the order of variable values/labels), "-" (decreasing by N), or "+" (increasing by N).

digits

Number of decimal places of output. Defaults to 1.

file

File name of MS Word (.doc).

Value

A data frame of frequency statistics.

Examples

data = psych::bfi

## Input `data$variable`
Freq(data$education)
Freq(data$gender, labels=c("Male", "Female"))
Freq(data$age)

## Input one data frame and one variable name
Freq(data, "education")
Freq(data, "gender", labels=c("Male", "Female"))
Freq(data, "age")


bruceR documentation built on June 22, 2024, 12:26 p.m.