1 |
Xquali |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (Xquali)
{
if (is.null(dim(Xquali))) {
p <- 1
Xijh <- vector("list", 1)
Xquali <- as.matrix(Xquali)
}
else {
p <- length(colnames(Xquali))
Xijh <- as.list(colnames(Xquali))
}
for (j in 1:p) {
Xih <- matrix(0, ncol = length(levels(Xquali[, j])),
nrow = nrow(Xquali))
modalite_ij <- matrix("", nrow = nrow(Xquali))
h_index <- 1
for (h in sort(levels(Xquali[, j]))) {
for (i in 1:nrow(Xquali)) {
if ((Xquali[i, j] == h)) {
Xih[i, h_index] <- 1
modalite_ij[i] <- h
}
else {
Xih[i, h_index] <- 0
}
}
h_index <- h_index + 1
}
Xijh[[j]] <- data.frame(proba = Xih, modalite = modalite_ij)
}
return(Xijh)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.