tabfreq: Frequency distribution table

View source: R/tabfreq.R

tabfreqR Documentation

Frequency distribution table

Description

Generic function that allows you to tabulate continuous and categorical data (quantitative or qualitative) in frequency distribution. Depending on the nature of the data, they can be grouped into class ranges or not.

Usage

tabfreq(data, ...)

Arguments

data

R object (data structure vector) of class leem. Use new_leem() function.

...

further arguments passed to or from other methods.

Value

The result of tabfreq() is a list. This list has two elements: table and statistics. The first is the data frequency table, and the second represents some useful statistics for methods of leem class.

Examples

# Example 1
library(leem)
x <- rbinom(36, 10, 0.6)
x <- new_leem(x, variable = "discrete")
tabfreq(x)

# Example 2 (Pipe operator)
rnorm(36, 100, 4) |>
  new_leem(variable = "continuous") |> tabfreq()

# Example 3
x <- rbinom(36, 10, 0.6)
# Constructor (object of leem class)
x <- new_leem(x, variable = "discrete")
tab <- tabfreq(x)
# Details
tab$table
tab$statistics

# Example 3 - ordered categories ("d","a", "b", "c")
w <- rep(letters[1:4], 1:4)
w |> new_leem(variable = "discrete") |> tabfreq(ordered = c("d","a", "b", "c"))


leem documentation built on April 3, 2025, 6:04 p.m.

Related to tabfreq in leem...