pop2prof {parsec} | R Documentation |
Population to profiles
Description
Extract the observed profiles and the corresponding frequencies, out of the statistical population.
Usage
pop2prof(
y,
labtype = c("profiles", "progressive", "rownames"),
sep = "",
weights = rep(1, nrow(y))
)
Arguments
y |
a dataset, used to count profile frequencies. See details. |
labtype |
users can choose the type of labels to assign to profiles. See details. |
sep |
variables separator in the profiles labels. |
weights |
a vector of length equal to the number of observations in |
Details
y
is a data.frame of observations on the ordinal or numeric variables. The partial order must be defined within the object type, so as to build the incidence matrix of the order relation (see getzeta
).
The function extracts variables and their observed modalities from the population; it builds all possible profiles and assigns to them the corresponding frequency. If some modalities are not observed in the population, they will not be used to build the profiles. If one is interested in the set of all possible profiles from a given set of variables, function var2prof
is to be used.
Users can choose the label type to assign to profiles. Accepetd types are: profiles
the variabiles modalities, progressive
a progressive numeration, rownames
the rownames in the dataset.
Value
The function returns a S3 class object wprof
, "weighted profiles", containing the data.frame
named profiles
and the frequency vector freq
.
See Also
Examples
n <- 5
v1 <- as.ordered(c("a", "b", "c", "d"))
v2 <- 1:3
pop <- data.frame(
v1 = sample(v1, n, replace = TRUE),
v2 = sample(v2, n, replace = TRUE)
)
pop2prof(pop)