R/getCorr.R

Defines functions getCorr

Documented in getCorr

getCorr <- function(x, y, rankBased = FALSE){
  n <- length(x)
  if(length(y) != n){stop("length of two vectors are different!")}
  if(rankBased){
    x <- rank(x)
    y <- rank(y)
  }
  
  out <- .C("corR", x=as.double(x), y=as.double(y), n=as.integer(n), cOut=as.double(0))
  
  r <- out$cOut
  return(r)
}
weiyi-bitw/cafr documentation built on May 4, 2019, 4:18 a.m.