Description Usage Arguments Value Author(s) Examples
This function summarize the calculation of similarity.
1 | simSum(sim)
|
sim |
Similarity matrix. |
List of similar documents to each documents. The number of list equals to ncol(sim).
Masaaki TAKADA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## The function is currently defined as
function (sim)
{
results <- rep(0, ncol(sim))
names(results) <- colnames(sim)
scores <- rep(0, ncol(sim))
for (i in 1:ncol(sim)) {
scores[i] <- max(sim[, i])
results[i] <- rownames(sim)[which.max(sim[, i])]
}
summary <- as.list(NULL, length = nrow(sim))
for (i in 1:nrow(sim)) {
cond <- results == rownames(sim)[i]
summary[[i]] <- names(which(cond[order(-scores)]))
}
names(summary) <- rownames(sim)
return(summary)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.