1 | Plot_quali(Dataquali, Em_results, all = TRUE)
|
Dataquali |
|
Em_results |
|
all |
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 | ##---- 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 (Dataquali, Em_results, all = TRUE)
{
tkx <- Em_results[[length(Em_results)]][["part_MAP"]]
Y <- apply(tkx, MARGIN = 1, which.max)
if (all) {
layout(matrix(1:ncol(Dataquali), ncol = floor(sqrt(ncol(Dataquali)))))
names_vars <- colnames(Dataquali)
for (i in 1:ncol(Dataquali)) {
my_variable <- table(Dataquali[, i], Y)
my_variable2 <- prop.table(my_variable, 1)
barplot(my_variable2, beside = TRUE, legend = paste("cluster",
rownames(my_variable2)), ylab = "proportion du cluster ",
xlab = names_vars[i], col = 1:length(unique(Y)))
}
}
else {
names_vars <- colnames(Dataquali)
for (i in 1:ncol(Dataquali)) {
my_variable <- table(Y, Dataquali[, i])
my_variable2 <- prop.table(my_variable, 1)
barplot(my_variable2, beside = TRUE, legend = paste("cluster",
rownames(my_variable2)), ylab = "proportion du cluster ",
xlab = names_vars[i], col = 1:length(unique(Y)))
}
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.