R/Sxy.R

Defines functions Sxy

Documented in Sxy

Sxy = function(x, y = x, na.rm = FALSE){
  if(na.rm){
    x = na.omit(x)
    y = na.omit(y)
  }
  if(length(x) == length(y)){
  return(sum( (x - mean(x)) * (y - mean(y))))
  } else {
  warning("Variables must have same length!")
  }
}

Try the desk package in your browser

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

desk documentation built on May 29, 2024, 6:05 a.m.