simSum: Summary of Document Similarity

Description Usage Arguments Value Author(s) Examples

View source: R/simSum.R

Description

This function summarize the calculation of similarity.

Usage

1
simSum(sim)

Arguments

sim

Similarity matrix.

Value

List of similar documents to each documents. The number of list equals to ncol(sim).

Author(s)

Masaaki TAKADA

Examples

 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)
  }


smdc documentation built on May 19, 2017, 8:53 a.m.
Search within the smdc package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.