Learn R Programming

summarytools (version 1.0.1)

tb: Convert Summarytools Objects into Tibbles

Description

Make a tidy dataset out of freq() or descr() outputs

Usage

tb(x, order = 1, na.rm = FALSE, drop.var.col = FALSE)

Value

A tibble which is constructed following the tidy principles.

Arguments

x

a freq() or descr() output object.

order

Integer. Useful for grouped results produced with stby or dplyr::group_by. When set to 1 (default), the ordering is done using the grouping variables first. When set to 2, the ordering is first determined by the variable column for descr or the column displaying the variable values for freq. When set to 3, the same ordering as with 2 is used, but columns are rearranged to reflect this sort order.

na.rm

Logical. For freq objects, remove <NA> rows (or (Missing) rows if NA values were made explicit with forcats::fct_explicit_na(). Has no effect on descr objects.

drop.var.col

Logical. For descr objects, drop the variable column. This is possible only when statistics are produced for a single variable; for multiple variables, this argument is ignored. FALSE by default.

Examples

Run this code

tb(freq(iris$Species))
tb(descr(iris))

data("tobacco")
tb(stby(tobacco, tobacco$gender, descr))

Run the code above in your browser using DataLab