Learn R Programming

summarytools (version 0.9.2)

stby: Obtain Grouped Statistics With summarytools

Description

This is essentially the base by function, except for the class of the returned object.

Usage

stby(data, INDICES, FUN, ..., simplify = TRUE)
byst(data, INDICES, FUN, ..., simplify = TRUE)

Arguments

data

an R object, normally a data frame, possibly a matrix.

INDICES

a factor or a list of factors, each of length nrow(data).

FUN

a function to be applied to (usually data-frame) subsets of data.

Further arguments to FUN.

simplify

Logical. Essentially a placeholder to maintain full compatibility with base by. For more details, see tapply.

Value

An object having classes “list” and “summarytools”.

See Also

by, tapply

Examples

Run this code
# NOT RUN {
data("tobacco")
stby(data = tobacco, INDICES = tobacco$gender, FUN = descr)

# }

Run the code above in your browser using DataLab