]> git.donarmstrong.com Git - ape.git/blobdiff - R/write.nexus.R
a few fixes
[ape.git] / R / write.nexus.R
index fd4407832b4c6ca2ddb12e78cc5a91b53466b7ab..00fcffc9f481614952d2bf8c5cf015bc819f7eba 100644 (file)
@@ -1,4 +1,4 @@
-## write.nexus.R (2012-02-09)
+## write.nexus.R (2012-03-02)
 
 ##   Write Tree File in Nexus Format
 
@@ -67,9 +67,8 @@ write.nexus <- function(..., file = "", translate = TRUE, original.data = NULL)
 
     for (i in 1:ntree) {
         if (class(obj[[i]]) != "phylo") next
-        if (is.rooted(obj[[i]]))
-          cat("\tTREE *,", title[i], "= [&R] ", file = file, append = TRUE)
-        else cat("\tTREE *", title[i], "= [&U] ", file = file, append = TRUE)
+        root.tag <- if (is.rooted(obj[[i]])) "= [&R] " else "= [&U] "
+        cat("\tTREE *", title[i], root.tag, file = file, append = TRUE)
         cat(write.tree(obj[[i]], file = ""),
             "\n", sep = "", file = file, append = TRUE)
     }