#' Correlation-based distance
#'
#' @param x matrix to compute correlation
#' @param beta exponent to attenuate correlation
#'
#' @author Brian S Yandell, \email{brian.yandell@@wisc.edu}
#' @keywords utilities
#'
#' @export
dist_cor <- function(x, beta = 1) {
if(!is.numeric(beta))
beta <- 1
if(beta < 0)
beta <- 1
if(beta > 6)
beta <- 6
as.dist(((1 - cor(t(x), use = "pairwise.complete.obs")) / 2) ^ beta)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.