- if (output.tree.names)
- names(phy) <- checkLabel(names(phy))
- if (inherits(phy, "multiPhylo")) {
- write.tree(phy[[1]], file = file, append = append,
- digits = digits, tree.names = names(phy)[1])
- if (length(phy) > 1)
- for (i in 2:length(phy)) write.tree(phy[[i]], file = file,
- append = TRUE, digits = digits, tree.names = names(phy)[i])
- return(invisible(NULL))
- }
- if (!inherits(phy, "phylo"))
- stop("object \"phy\" is not of class \"phylo\"")
+
+ for (i in 1:N)
+ res[i] <- .write.tree2(phy[[i]], digits = digits,
+ tree.prefix = tree.names[i])
+
+ if (file == "") return(res)
+ else cat(res, file = file, append = append, sep = "\n")
+}
+
+.write.tree2 <- function(phy, digits = 10, tree.prefix = "")
+{