Description Usage Arguments Details Value See Also Examples
Extract from a population the observed profiles and their frequencies.
1 |
y |
an observations matrix, used to count the profiles frequencies. See details. |
labtype |
the user can choose the type of labels to assign to the profiles. See details. |
The parameter y
is a data.frame of observation of the ordinal or numeric variables. It is important that the order is defind into the object type, in order to build the incidence matrix (see getzeta
).
The function estracts from the population the variables and their observed modalities, from them, it builds all the possible profiles and it assign them the frequencies. Note that, if some modalities are not observed their will not used to build the profiles. Therefore, this function shuld be used only if the variables definition has to be detected from the population, otherwise the function var2prof
has to be used.
The user can choose the type label to assign to profiles. profiles
is the combination of modailties that identify the profiles. When the names of the modalities are long, it is better to choose progressive
, that assign to each profile a progressive number preceded by the letter "P".
The function returns an object of S3 class wprof
, "weighted profiles", which contains the data.frame
named profiles
and the vector of frequencies freq
.
1 2 3 4 5 6 7 8 | 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)
|
$profiles
v1 v2
a/1 a 1
b/1 b 1
b/2 b 2
d/3 d 3
$freq
a/1 b/1 b/2 d/3
1 1 2 1
attr(,"class")
[1] "wprof"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.