Skip to content

Commit

Permalink
fix colliding file
Browse files Browse the repository at this point in the history
  • Loading branch information
AOST authored and AOST committed Dec 29, 2023
1 parent 7349a6e commit ca940c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 58 deletions.
26 changes: 11 additions & 15 deletions docs/_static/code/simil.R
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@

##
## FUNCTION simil() similarity based on data frame coocurrences
## FUNCTION simil() to compute similarity of entries in a given data frame
## (CC BY-SA 4.0) Antonio Rivero Ostoic, jaro@cas.au.dk
##
## version 0.1 (16-04-2020)
## version 0.2 (11-03-2020)
##
## Parameters
## x a data frame or a list object with vectors to compare
## INPUT AND ARGUMENTS
## x a data frame with an ID column
## att (vector) column(s) in x representing attributes
## null (optional) include NA or NULLs?
## uniq (optional) remove duplicates?
## diag.incl (optional) include entries in diagonal?


simil <-
function (x, att, null, uniq, diag.incl)
{
ifelse(is.data.frame(x) == FALSE, x <- as.data.frame(do.call(rbind,
x)), NA)
if (missing(att) == TRUE) {
att <- seq_len(ncol(x))
}
else {
ifelse(is.vector(att) == TRUE, NA, stop("\"att\" must be a vector."))
}
ifelse(missing(null) == FALSE && isTRUE(null == TRUE) ==
TRUE, null <- TRUE, null <- FALSE)
ifelse(missing(uniq) == FALSE && isTRUE(uniq == FALSE) ==
TRUE, NA, x <- unique(x))
TRUE, uniq <- FALSE, uniq <- TRUE)
ifelse(isTRUE(uniq == TRUE) == TRUE, x <- unique(x), NA)
ifelse(is.null(x$ID) == TRUE, mat <- matrix(0L, nrow = nrow(x),
ncol = nrow(x), dimnames = list(unlist(x[, 1]), unlist(x[,
1]))), mat <- matrix(0L, nrow = nrow(x), ncol = nrow(x),
dimnames = list(x$ID, x$ID)))
for (at in att) {
ccat <- unlist(unique(x[, at]))
ifelse(missing(null) == FALSE && isTRUE(null == TRUE) ==
TRUE, NA, ccat <- ccat[which(ccat != "NULL")])
ifelse(isTRUE(null == TRUE) == TRUE, NA, ccat <- ccat[which(ccat !=
"NULL")])
for (i in seq_len(length(ccat))) {
mat[which(x[, at] == ccat[i]), which(x[, at] == ccat[i])] <- mat[which(x[,
at] == ccat[i]), which(x[, at] == ccat[i])] +
Expand Down
43 changes: 0 additions & 43 deletions docs/_static/code/simil.r

This file was deleted.

0 comments on commit ca940c2

Please sign in to comment.