R/lincos.R

Defines functions lincos

Documented in lincos

lincos <- function(x) {
   if(is.vector(x)) {
      y <- rep(NULL,length(x))
      x <- abs(x)
      y[x < pi]  <- -2*x[x < pi]/pi +1
      y[x >= pi] <- 2*x[x >= pi]/pi - 3
   }
   if(is.matrix(x)) {
      y <- matrix(rep(0,ncol(x)*nrow(x)),ncol=ncol(x))
      x <- abs(x)      
      y[x < pi]  <- -2*x[x < pi]/pi +1
      y[x >= pi] <- 2*x[x >= pi]/pi - 3
   }
   return(y)
}

Try the Correlplot package in your browser

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

Correlplot documentation built on March 7, 2023, 8:33 p.m.