This is not a one-to-one copy of base::table()
as some behaviours differ.
It is more flexible as it accepts inputs such as data frames and
vctrs_rcrd
objects.
cheapr_table(
...,
names = TRUE,
order = FALSE,
na_exclude = FALSE,
classed = FALSE
)counts(x, sort = is.factor(x))
A named integer vector if one object is supplied, otherwise an array.
>=1
objects that can be converted to a factor through
cheapr::factor_()
.
Should level names be kept? Default is TRUE
.
Should result be ordered by level names? Default is
FALSE
.
Should NA
values be excluded? Default is FALSE
.
Should a table
object be returned? Default is FALSE
A vector.
Should groups be sorted? Default is FALSE
.
cheapr_table()
tries to match the behaviour of table()
where possible.
counts()
alternatively works only for atomic vectors and
is faster, returning a data.frame
of counts.