[Phylobase-commits] r154 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 8 02:13:31 CET 2008


Author: pdc
Date: 2008-03-08 02:13:31 +0100 (Sat, 08 Mar 2008)
New Revision: 154

Modified:
   pkg/R/methods-phylo4.R
   pkg/R/phylo4.R
Log:
Missed a couple of methods

Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R	2008-03-08 01:11:40 UTC (rev 153)
+++ pkg/R/methods-phylo4.R	2008-03-08 01:13:31 UTC (rev 154)
@@ -255,11 +255,23 @@
     return(invisible(res))
 }) # end setMethod summary phylo4
 
-################
-## names methods
-################
 setMethod("names", signature(x = "phylo4"), function(x){
     temp <- rev(names(attributes(x)))[-1]
     return(rev(temp))
 })
 
+setMethod("hasEdgeLength","phylo4", function(x) {
+    length(x at edge.length)>0
+})
+
+setMethod("labels","phylo4", function(object,...) {
+    object at tip.label
+})
+
+setMethod("labels<-","phylo4", function(object,...,value) {
+    if (length(value) != length(object at tip.label))
+        stop("Number of tip labels does not match number of tips.")
+    object at tip.label <- value
+    object
+})
+

Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R	2008-03-08 01:11:40 UTC (rev 153)
+++ pkg/R/phylo4.R	2008-03-08 01:13:31 UTC (rev 154)
@@ -48,15 +48,11 @@
 setGeneric("hasEdgeLength", function(x) {
     standardGeneric("hasEdgeLength")
 })
-setMethod("hasEdgeLength","phylo4", function(x) {
-    length(x at edge.length)>0
-})
 
 setGeneric("edgeLength", function(x) {
     standardGeneric("edgeLength")
 })
 
-
 setGeneric("hasNodeLabels", function(x) {
     standardGeneric("hasNodeLabels")
 })
@@ -66,20 +62,11 @@
 })
 
 setGeneric("labels")
-setMethod("labels","phylo4", function(object,...) {
-    object at tip.label
-})
 
 setGeneric("labels<-",
            function(object,...,value) {
                standardGeneric("labels<-")
            })
-setMethod("labels<-","phylo4", function(object,...,value) {
-    if (length(value) != length(object at tip.label))
-        stop("Number of tip labels does not match number of tips.")
-    object at tip.label <- value
-    object
-})
 
 setGeneric("nodeLabels", function(x) {
     standardGeneric("nodeLabels")



More information about the Phylobase-commits mailing list