tabfreq | R Documentation |
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.
tabfreq(data, ...)
data |
R object (data structure vector) of class leem. Use |
... |
further arguments passed to or from other methods. |
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.
# 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.