[Phylobase-commits] r367 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Dec 20 04:44:09 CET 2008
Author: bbolker
Date: 2008-12-20 04:44:09 +0100 (Sat, 20 Dec 2008)
New Revision: 367
Modified:
pkg/R/methods-phylo4d.R
Log:
formatting, stub for labels
Modified: pkg/R/methods-phylo4d.R
===================================================================
--- pkg/R/methods-phylo4d.R 2008-12-20 03:43:27 UTC (rev 366)
+++ pkg/R/methods-phylo4d.R 2008-12-20 03:44:09 UTC (rev 367)
@@ -5,6 +5,8 @@
setMethod("tdata", "phylo4d", function(x, which = c("tip",
"node", "allnode"), label.type=c("row.names","column"), ...) {
which <- match.arg(which)
+ ## FIXME: should have no labels in this case?
+ if (!hasNodeLabels(x) && which=="node" && missing(label.type)) { }
label.type <- match.arg(label.type)
if (which == "tip") {
if (all(dim(x at tip.data)==0)) {
@@ -13,11 +15,15 @@
tdata <- x at tip.data
data.names <- x at tip.label
if ( identical(label.type,"row.names") ) {
- if ( identical(data.names,unique(data.names)) || !(any(is.na(data.names))) ) {
- row.names(tdata) <- data.names
+ if ( identical(data.names,unique(data.names)) ||
+ !(any(is.na(data.names))) ) {
+ row.names(tdata) <- data.names
}
else {
- warning("Non-unique or missing labels found, labels cannot be coerced to tdata row.names. Use the label.type argument to include labels as first column of data.")
+ warning("Non-unique or missing labels found, ",
+ "labels cannot be coerced to tdata row.names. ",
+ "Use the label.type argument to include labels ",
+ "as first column of data.")
}
}
if (identical(label.type,"column")) {
@@ -38,9 +44,9 @@
!(any(is.na(data.names)))) {
row.names(tdata) <- data.names
} else {
- warning("Non-unique or missing labels found,",
- "labels cannot be coerced to tdata row.names.",
- "Use the label.type argument to include labels",
+ warning("Non-unique or missing labels found, ",
+ "labels cannot be coerced to tdata row.names. ",
+ "Use the label.type argument to include labels ",
"as first column of data.")
}
}
@@ -121,7 +127,7 @@
cat("\nComparative data:\n")
if (nrow(tips) > 0) {
cat("\nTips: data.frame with", nTips(object), "taxa and",
- ncol(tips), "variables \n\n")
+ ncol(tips), "variable(s) \n\n")
print(summary(tips))
}
else {
More information about the Phylobase-commits
mailing list