R/cor.R

Defines functions wrong_cor select_cor

select_cor <- function(x, cor) {
  if (cor == TRUE) {
    x <- cor(x)
  } else if (cor == FALSE) {
    x <- cov(x)
  } else {
    wrong_cor(cor=cor)
  }

  return(x)
}

wrong_cor <- function(cor) {
  stop(
    paste(
      "'",
      cor,
      "'",
      " is not a valid value for cor.",
      sep=""
    )
  )
}

Try the prinvars package in your browser

Any scripts or data that you put into this service are public.

prinvars documentation built on Jan. 9, 2023, 5:12 p.m.