We are hiring ! See our job offers.
https://github.com/cran/CluMix
Raw File
Tip revision: 4fbb09ab94eb59bfa4196e2a4898f4e30c2845ab authored by Manuela Hummel on 21 January 2019, 08:10:22 UTC
version 2.3.1
Tip revision: 4fbb09a
dendro.variables.R
dendro.variables <- function(data, method=c("associationMeasures", "distcor", "ClustOfVar"), linkage="ward.D2", associationFun=association, check.psd=TRUE){
  
  method <- match.arg(method)
  if(method == "associationMeasures"){
    S <- similarity.variables(data, associationFun=associationFun, check.psd=check.psd)
    D.variables <- as.dist(sqrt(1 - S))
    dend <- as.dendrogram(hclust(D.variables, method=linkage))
  }

  else if(method == "distcor"){
    D.variables <- dcor_dist_bc(data)
    dend <- as.dendrogram(hclust(D.variables, method=linkage))
  }

  else if(method == "ClustOfVar"){
     dc <- sapply(data, data.class)
    if(any(dc == "numeric"))
      X.quanti <- data[,dc == "numeric"]
    else
      X.quanti <- NULL
    if(all(dc == "numeric"))
      X.quali <- NULL
    else
      X.quali <- data[,dc != "numeric"]
    dend <- as.dendrogram(ClustOfVar::hclustvar(X.quanti, X.quali))
  }
  
  return(dend)
}
back to top