similarities: similarities

Description Usage Arguments Value Examples

Description

sims and similarities both calculate for each pair of source code objects the similarity coefficients and return a data frame with the coefficients in descending order. A larger coefficient means a greater similarity.

Usage

1
2
3
4
5
6
7
8
sims(...)

similarities(
  docs,
  all = FALSE,
  coeff = c("jaccard", "braun", "dice", "hamann", "kappa", "kulczynski", "ochiai",
    "phi", "russelrao", "matching", "simpson", "sneath", "tanimoto", "yule")
)

Arguments

...

all parameters in sims are given to similarities

docs

document object

all

logical: should the similarity coefficients computed based on all sourcecode objects or just the two considered (default: FALSE)

coeff

character: coefficient to compute (default: "jaccard"), abbreviations can be used

Value

a data frame with the results

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# example files are taken from https://CRAN.R-project.org/package=SimilaR
files <- list.files(system.file("examples", package="rscc"), "*.R$", full.names=TRUE)
prgs  <- sourcecode(files, basename=TRUE)
docs  <- documents(prgs)
similarities(docs)
# further steps
# m  <- similarities(docs)
# df <- matrix2dataframe(m)
# head(df, n=20)
# browse(prgs, df, n=5)

rscc documentation built on Jan. 20, 2022, 5:08 p.m.