R/angleToR.R

Defines functions angleToR

Documented in angleToR

angleToR <-
function(x,ifun="cos") {
#
# from angles (in radians) to a correlation matrix
# all angles w.r.t. positive x-axis.
#
   theta <- x
   ncor <- length(theta)
   CC <- matrix(rep(theta,ncor),nrow=ncor)
   DD <- CC-t(CC) # differences in angle, 0's on diagonal.
   R <- switch(ifun, cos = cos(DD) , lincos = lincos(DD), stop("angleToR: invalid interpretation function"))
   return(R)
}

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.