]> git.donarmstrong.com Git - ape.git/blobdiff - R/Cheverud.R
some updates for ape 3.0-7
[ape.git] / R / Cheverud.R
index ab7e24bb4eab18726bccab3ee5cc6c4da549c433..a2073d05aa7ca53ca1a5b93cb89a6cc8ef340eff 100644 (file)
@@ -12,7 +12,9 @@
 # Evolution 55(11): 2143-2160
 compar.cheverud <- function(y, W, tolerance=1e-6, gold.tol=1e-4)
 {
-  W <- W - diag(W) # ensure diagonal is zero
+  ## fix by Michael Phelan
+  diag(W) <- 0 # ensure diagonal is zero
+  ## end of fix
   y <- as.matrix(y)
   if(dim(y)[2] != 1) stop("Error: y must be a single column vector.")
   D <- solve(diag(apply(t(W),2,sum)))
@@ -33,7 +35,7 @@ compar.cheverud <- function(y, W, tolerance=1e-6, gold.tol=1e-4)
          }
     sorted[ii] <- Re(sorted[ii]) # Remove imaginary part
   }
-  sorted <- as.real(sorted)
+  sorted <- as.double(sorted)
 
        Distinct <- numeric(0)
   Distinct[1] <- -Inf