Learn R Programming

descriptio (version 1.3)

profiles: Profiles by level of a categorical variable

Description

Computes profiles (frequencies or percentages) for subgroups of observations defined by the levels of a categorical variable.

Usage

profiles(X, y, weights = NULL, stat = "cprop",
 mar = TRUE, digits = 1)

Value

A data frame with profiles in columns

Arguments

X

data frame. The variables which are described in the profiles. There should be only factors.

y

factor. The categorical variable which defines subgroups of observations whose profiles will be computed.

weights

numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used.

stat

character. Whether to compute frequencies ("freq"), percentages ("prop"), row percentages ("rprop") or column percentages ("cprop", default).

mar

logical, indicating whether to compute margins. Default is TRUE.

digits

numeric. Number of digits. Default is 1.

Author

Nicolas Robette

See Also

catdesc, assoc.yx, darma, assoc.twocat, assoc.twocat.by

Examples

Run this code
data(Movies)
profiles(Movies[,c(2,4,5)], Movies$Country)

Run the code above in your browser using DataLab