Description Usage Arguments Author(s) Examples
Inverse CrossTabualtion
1 | ict(crosstab)
|
crosstab |
SeyedMahmood TaghaviShahri
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 | ##---- 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 (crosstab)
{
crosstab = as.matrix(crosstab)
n1 = 1:nrow(crosstab)
n2 = 1:ncol(crosstab)
d1 = c()
d2 = c()
for (i in n1) for (j in n2) {
count = crosstab[i, j]
if (is.na(count))
warning(paste("NA in row", i, ", column", j, "exist!"),
immediate. = TRUE)
else if (count > 0)
for (k in 1:count) {
d1 = c(d1, n1[i])
d2 = c(d2, n2[j])
}
}
d1 = factor(d1, labels = rownames(crosstab))
d2 = factor(d2, labels = colnames(crosstab))
list(d1 = d1, d2 = d2)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.