R/cor_rv.R

Defines functions cor.rv

Documented in cor.rv

# ========================================================================
# cor  -  correlation function
# ========================================================================

#' @importFrom stats cor
#' @rdname distrib_rv
cor.rv <- function(x, y=NULL, ...)  {
  if (!is.matrix(x)) {
    if (is.null(y)) {
      stop("supply both x and y or a matrix-like x")
    }
    x <- as.vector(x)
  }
  if (is.rvobj(x) || is.rvobj(y)) {
    rvmapply(cor, x=x, y=y, ...)
  } else {
    cor(x=x, y=y, ...)
  }
}
jsta/rv documentation built on Feb. 12, 2022, 5:13 p.m.