A minor helper function to convert correlations (ranging from -1 to 1) to distances (ranging from 0 to 2). \(d = \sqrt{(2(1-r))}\).
cor2dist(x)
dist: a square matrix of distances.
If square, then assumed to be a correlation matrix, otherwise the correlations are found first.
William Revelle
Revelle, William. (in prep) An introduction to psychometric theory with applications in R. Springer. Working draft available at https://personality-project.org/r/book/