]> git.donarmstrong.com Git - ape.git/blobdiff - R/ace.R
removing NPRS + change bind.tree.Rd to avoid crash during R CMD check ape
[ape.git] / R / ace.R
diff --git a/R/ace.R b/R/ace.R
index 9ea659001688562e42f6e6f557b22720ad0830b2..87ed1f2e60503d1e8de35d00ff94aafcd82582b6 100644 (file)
--- a/R/ace.R
+++ b/R/ace.R
@@ -1,4 +1,4 @@
-## ace.R (2010-04-23)
+## ace.R (2010-05-12)
 
 ##   Ancestral Character Estimation
 
@@ -238,16 +238,22 @@ print.ace <- function(x, digits = 4, ...)
     print(x$call)
     cat("\n")
     cat("    Log-likelihood:", x$loglik, "\n\n")
-    cat("Rate index matrix:\n")
     ratemat <- x$index.matrix
-    dimnames(ratemat)[1:2] <- dimnames(x$lik.anc)[2]
-    print(ratemat, na.print = ".")
-    cat("\n")
-    npar <- length(x$rates)
-    estim <- data.frame(1:npar, round(x$rates, digits), round(x$se, digits))
-    cat("Parameter estimates:\n")
-    names(estim) <- c("rate index", "estimate", "std-err")
-    print(estim, row.names = FALSE)
-    cat("\nScaled likelihoods at the root (type 'x$lik.anc' to get them for all nodes):\n")
-    print(x$lik.anc[1, ])
+    if (is.null(ratemat)) { # to be improved
+        class(x) <- NULL
+        x$loglik <- x$call <- NULL
+        print(x)
+    } else {
+        dimnames(ratemat)[1:2] <- dimnames(x$lik.anc)[2]
+        cat("Rate index matrix:\n")
+        print(ratemat, na.print = ".")
+        cat("\n")
+        npar <- length(x$rates)
+        estim <- data.frame(1:npar, round(x$rates, digits), round(x$se, digits))
+        cat("Parameter estimates:\n")
+        names(estim) <- c("rate index", "estimate", "std-err")
+        print(estim, row.names = FALSE)
+        cat("\nScaled likelihoods at the root (type 'x$lik.anc' to get them for all nodes):\n")
+        print(x$lik.anc[1, ])
+    }
 }