[Phylobase-commits] r583 - in pkg: R man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 25 02:51:07 CEST 2009


Author: francois
Date: 2009-08-25 02:51:06 +0200 (Tue, 25 Aug 2009)
New Revision: 583

Added:
   pkg/man/formatData.Rd
   pkg/man/phylo4-accessors.Rd
   pkg/man/phylo4-labels.Rd
Removed:
   pkg/man/check.phylo4d.Rd
   pkg/man/nNodes-methods.Rd
Modified:
   pkg/R/methods-phylo4.R
   pkg/R/methods-phylo4d.R
   pkg/R/phylo4.R
   pkg/man/as-methods.Rd
   pkg/man/pdata-class.Rd
   pkg/man/phylo4d-class.Rd
   pkg/man/phylo4d.Rd
   pkg/man/phylobase-package.Rd
   pkg/tests/misctests.Rout.save
Log:
* created function hasTipData for consistency
* added test on validity of phylo4 object after updating tip and node labels
* reorganization of documentation:
  - renamed nNodes-phylo4.Rd to phylo4-accessors.Rd
  - renamed check.phylo4d.Rd to formatData.Rd (it's now the only function it holds)
  - created a phylo4-labels.Rd file to make phylo4-accessors.Rd clearer
  - updated phylobase-package.Rd to make lines shorter, so they are not masked in PDF manual
  - fixed formatting in as-methods.Rd
  - moved examples from check.phylo4d.Rd to phylo4d.Rd


Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/R/methods-phylo4.R	2009-08-25 00:51:06 UTC (rev 583)
@@ -289,6 +289,7 @@
 setReplaceMethod("nodeLabels", signature(object="phylo4", value="character"),
   function(object, ..., value) {
       labels(object, type="internal", ...) <- value
+      if(is.character(checkval <- checkPhylo4(object))) stop(checkval)
       object
   })
 
@@ -300,6 +301,7 @@
 setReplaceMethod("tipLabels", signature(object="phylo4", value="character"),
   function(object, ...,  value) {
       labels(object, type="tip", ...) <- value
+      if(is.character(checkval <- checkPhylo4(object))) stop(checkval)
       return(object)
   })
 

Modified: pkg/R/methods-phylo4d.R
===================================================================
--- pkg/R/methods-phylo4d.R	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/R/methods-phylo4d.R	2009-08-25 00:51:06 UTC (rev 583)
@@ -217,6 +217,9 @@
     nrow(x at node.data) > 0
 })
 
+setMethod("hasTipData", "phylo4d", function(x) {
+    nrow(x at tip.data) > 0
+})
 
 ## FIXME: doesn't deal with missing node data
 ##   (don't even know how that should be done in this case)

Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/R/phylo4.R	2009-08-25 00:51:06 UTC (rev 583)
@@ -118,6 +118,10 @@
     standardGeneric("hasNodeData")
 })
 
+setGeneric("hasTipData", function(x) {
+    standardGeneric("hasTipData")
+})
+
 setGeneric("na.omit")
 
 setGeneric("reorder")

Modified: pkg/man/as-methods.Rd
===================================================================
--- pkg/man/as-methods.Rd	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/man/as-methods.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -58,14 +58,14 @@
   additional information from the user. Conversions exist for
   combinations:
 
-  \describe{
+  \itemize{
   
     \item{}{\code{phylobase} to \code{phylobase} formats:}
     \itemize{   
-      \item{\code{as(object, "phylo4d")}}{where object is of class
+      \item{}{\code{as(object, "phylo4d")} where object is of class
 	\linkS4class{phylo4} and returns an object of class
-	\linkS4class{phylo4d}, with empty data.} 
-      \item{\code{as(object, "phylo4")}}{where object is of class
+	\linkS4class{phylo4d}, with empty data.}
+      \item{}{\code{as(object, "phylo4")} where object is of class
 	\linkS4class{phylo4d} and returns an object of class
 	\linkS4class{phylo4}. If data are dropped during the conversion, a
 	warning message is produced. A similar conversion can be done by
@@ -75,37 +75,37 @@
     
     \item{}{\code{phylobase} to \code{ape} formats:}
     \itemize{
-      \item{\code{as(object, "phylo")}}{where object is of class
+      \item{}{\code{as(object, "phylo")}}{where object is of class
 	\linkS4class{phylo4} or \linkS4class{phylo4d} and returns an
 	object of class \code{phylo}. If data are dropped during the
 	conversion from a \code{phylo4d} object, a warning message is
 	produced.}
-      \item{\code{as(object, "multiPhylo")}}{ ~~Not implemented
+      \item{}{\code{as(object, "multiPhylo")}}{ ~~Not implemented
 	yet. where object is of class \linkS4class{multiPhylo4} and returns
 	an object of class \code{multiPhylo}. }
     }
     
     \item{}{\code{ape} to \code{phylobase} formats:}
     \itemize{
-      \item{\code{as(object, "phylo4")}}{where object is of class
+      \item{}{\code{as(object, "phylo4")}}{where object is of class
 	\code{phylo} and returns an object of class \code{phylo4}.}
-      \item{\code{as(object, "phylo4d")}}{where object is of class
+      \item{}{\code{as(object, "phylo4d")}}{where object is of class
 	\code{phylo} and returns an object of class \code{phylo4d}, with
 	empty data.} 
-      \item{\code{as(object, "multiPhylo4")}}{ ~~Not implemented
+      \item{}{\code{as(object, "multiPhylo4")}}{ ~~Not implemented
 	yet. where object is of class \code{multiPhylo} and returns an
 	object of class \code{multiPhylo4}. } 
     }
     
     \item{}{\code{phylobase} to \code{ade4} formats:}
     \itemize{
-      \item{\code{as(object, "phylog")}}{where object is of class
+      \item{}{\code{as(object, "phylog")}}{where object is of class
 	\code{phylo4} and returns an object of class \linkS4class{phylog}.} 
     }
     
     \item{}{\code{phylobase} format to \code{data.frame}:}
     \itemize{
-      \item{\code{as(object, "data.frame")}}{where object is of class
+      \item{}{\code{as(object, "data.frame")}}{where object is of class
 	\code{phylo4} or \code{phylo4d} and returns an object of class
 	\code{data.frame}, with data included in the case of
 	\code{phylo4d}.} 

Deleted: pkg/man/check.phylo4d.Rd
===================================================================
--- pkg/man/check.phylo4d.Rd	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/man/check.phylo4d.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -1,116 +0,0 @@
-\name{formatData}
-\alias{formatData}
-
-\title{Formatting data before attaching them to a phylo4 object}
-
-\description{
-  Basic checks on the validity of S4 phylogenetic plus data objects
-  (i.e. \linkS4class{phylo4d} objects).
-}
-
-\usage{
-  formatData(phy, dt, type=c("tip", "internal", "all"),
-              match.data=TRUE, rownamesAsLabels=FALSE,
-              label.type=c("rownames", "column"),
-              label.column=1, missing.data=c("fail", "warn", "OK"),
-              extra.data=c("warn", "OK", "fail"))                       
-}
-
-\arguments{
-  \item{phy}{a valid \code{phylo4} object}
-  \item{dt}{a data frame or a vector}
-  \item{type}{type of data to attach}
-  \item{match.data}{(logical) Are data labels matched against tree
-    labels?} 
-  \item{label.type}{character, \code{rownames} or \code{column}: should
-    the labels be taken from the row names of \code{dt} or from
-    the \code{label.column} column of \code{dt}?}
-  \item{label.column}{if \code{label.type=="column"}, column specifier
-    (number or name) of the column containing tip labels}
-  \item{missing.data}{action to take if there are missing data or if
-    there are data labels that don't match}
-  \item{extra.data}{action to take if there are extra data or if there
-    are labels that don't match} 
-  \item{rownamesAsLabels}{(logical), in the case of number-like labels
-    should the row names of the data provided be considered as labels
-    (TRUE) or node numbers (FALSE and default)}
-  
-}
-
-\value{
-  \code{formatData} returns a data frame having node numbers as row
-  names. The data frame is also formatted to have the correct dimension
-  given the \code{phylo4} object provided.
-}
-
-\details{
-
-  \code{formatData} is an internal function that should not be called by
-  the user. It formats properly the data provided by the user before
-  being attached to a tree.
-  
-  By default, data names are used to attach tip data to the
-  tree. In this case data names must be present and must match the set
-  of tip or internal nodes exactly. The matching process can be done
-  either by using \code{phylo4} labels (i.e. tip or node) or by using
-  node numbers. It is possible to provide both at the same time by using
-  the option \code{rownamesAsLabels=FALSE}.
-  
-  \code{formatData} (1) converts labels provided in the data into node
-  numbers, (2) makes sure that the data are appropriately matched
-  against  tip or nodes, (3) checks for differences between data and
-  tree, (4) creates a data frame with the correct dimensions given a
-  tree.
-  
-}
-
-\seealso{the \code{\link{phylo4d}} constructor, the
-  \linkS4class{phylo4d} class. See also the \code{\link{checkPhylo4}},
-  the \code{\link{phylo4}} constructor and the \linkS4class{phylo4}
-  class. See \code{\link{coerce-methods}} for translation functions.}
-
-\author{Francois Michonneau}
-
-\examples{
-require(ape) ## for rcoal
-## generate a tree and some data
-set.seed(1)
-p3 <- rcoal(5)
-dat <- data.frame(a = rnorm(5), b = rnorm(5), row.names = p3$tip.label)
-dat.defaultnames <- dat
-row.names(dat.defaultnames) <- NULL
-dat.superset <- rbind(dat, rnorm(2))
-dat.subset <- dat[-1, ]
-
-## create a phylo4 object from a phylo object
-p4 <- as(p3, "phylo4")
-
-## create phylo4d objects with tip data
-p4d <- phylo4d(p4, dat)
-###checkData(p4d)
-p4d.sorted <- phylo4d(p4, dat[5:1, ])
-try(p4d.nonames <- phylo4d(p4, dat.defaultnames))
-p4d.nonames <- phylo4d(p4, dat.defaultnames, match.data=FALSE)
-
-\dontrun{
-p4d.subset <- phylo4d(p4, dat.subset)
-p4d.subset <- phylo4d(p4, dat.subset)
-try(p4d.superset <- phylo4d(p4, dat.superset))
-p4d.superset <- phylo4d(p4, dat.superset)
-}
-
-## create phylo4d objects with node data
-nod.dat <- data.frame(a = rnorm(4), b = rnorm(4))
-p4d.nod <- phylo4d(p4, node.data = nod.dat, match.data=FALSE)
-
-
-## create phylo4 objects with node and tip data
-p4d.all1 <- phylo4d(p4, node.data = nod.dat, tip.data = dat, match.data=FALSE)
-nodeLabels(p4) <- as.character(sort(nodeId(p4)))
-p4d.all2 <- phylo4d(p4, all.data = rbind(dat, nod.dat, match.data=FALSE))
-
-## examples of merge.data
-
-
-}
-\keyword{misc}

Copied: pkg/man/formatData.Rd (from rev 578, pkg/man/check.phylo4d.Rd)
===================================================================
--- pkg/man/formatData.Rd	                        (rev 0)
+++ pkg/man/formatData.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -0,0 +1,76 @@
+\name{formatData}
+\alias{formatData}
+
+\title{Formatting data before attaching them to a phylo4 object}
+
+\description{
+  Basic checks on the validity of S4 phylogenetic plus data objects
+  (i.e. \linkS4class{phylo4d} objects).
+}
+
+\usage{
+  formatData(phy, dt, type=c("tip", "internal", "all"),
+              match.data=TRUE, rownamesAsLabels=FALSE,
+              label.type=c("rownames", "column"),
+              label.column=1, missing.data=c("fail", "warn", "OK"),
+              extra.data=c("warn", "OK", "fail"))                       
+}
+
+\arguments{
+  \item{phy}{a valid \code{phylo4} object}
+  \item{dt}{a data frame or a vector}
+  \item{type}{type of data to attach}
+  \item{match.data}{(logical) Are data labels matched against tree
+    labels?} 
+  \item{label.type}{character, \code{rownames} or \code{column}: should
+    the labels be taken from the row names of \code{dt} or from
+    the \code{label.column} column of \code{dt}?}
+  \item{label.column}{if \code{label.type=="column"}, column specifier
+    (number or name) of the column containing tip labels}
+  \item{missing.data}{action to take if there are missing data or if
+    there are data labels that don't match}
+  \item{extra.data}{action to take if there are extra data or if there
+    are labels that don't match} 
+  \item{rownamesAsLabels}{(logical), in the case of number-like labels
+    should the row names of the data provided be considered as labels
+    (TRUE) or node numbers (FALSE and default)}
+  
+}
+
+\value{
+  \code{formatData} returns a data frame having node numbers as row
+  names. The data frame is also formatted to have the correct dimension
+  given the \code{phylo4} object provided.
+}
+
+\details{
+
+  \code{formatData} is an internal function that should not be called by
+  the user. It formats properly the data provided by the user before
+  being attached to a tree.
+  
+  By default, data names are used to attach tip data to the
+  tree. In this case data names must be present and must match the set
+  of tip or internal nodes exactly. The matching process can be done
+  either by using \code{phylo4} labels (i.e. tip or node) or by using
+  node numbers. It is possible to provide both at the same time by using
+  the option \code{rownamesAsLabels=FALSE}.
+  
+  \code{formatData} (1) converts labels provided in the data into node
+  numbers, (2) makes sure that the data are appropriately matched
+  against  tip or nodes, (3) checks for differences between data and
+  tree, (4) creates a data frame with the correct dimensions given a
+  tree.
+  
+}
+
+\seealso{the \code{\link{phylo4d}} constructor, the
+  \linkS4class{phylo4d} class. See also the \code{\link{checkPhylo4}},
+  the \code{\link{phylo4}} constructor and the \linkS4class{phylo4}
+  class. See \code{\link{coerce-methods}} for translation functions.}
+
+\author{Francois Michonneau}
+
+\examples{
+}
+\keyword{misc}


Property changes on: pkg/man/formatData.Rd
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: pkg/man/nNodes-methods.Rd
===================================================================
--- pkg/man/nNodes-methods.Rd	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/man/nNodes-methods.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -1,162 +0,0 @@
-\name{phylo4-accessors}
-\docType{methods}
-\alias{nNodes}
-\alias{nNodes-methods}
-\alias{nNodes,phylo4-method}
-\alias{nTips}
-\alias{nTips-methods}
-\alias{nTips,phylo4-method}
-\alias{nTips,ANY-method}
-\alias{labels<-}
-\alias{labels,phylo4-method}
-\alias{labels<-,phylo4,ANY,ANY,character-method}
-\alias{labels<-,phylo4d,ANY,ANY,character-method}
-\alias{edges}
-\alias{edges-methods}
-\alias{edges,phylo4-method}
-\alias{nEdges}
-\alias{nEdges-methods}
-\alias{nEdges,phylo4-method}
-\alias{edgeOrder}
-\alias{edgeOrder,phylo4-method}
-\alias{hasEdgeLength}
-\alias{hasEdgeLength-methods}
-\alias{hasEdgeLength,phylo4-method}
-\alias{edgeLength}
-\alias{edgeLength-methods}
-\alias{edgeLength,phylo4-method}
-\alias{edgeLength<-}
-\alias{edgeLength<-,phylo4-method}
-\alias{edgeLength<-,phylo4,ANY-method}
-\alias{nodeType}
-\alias{nodeType,phylo4-method}
-\alias{isRooted}
-\alias{isRooted-methods}
-\alias{isRooted,phylo4-method}
-\alias{rootEdge}
-\alias{rootEdge-methods}
-\alias{rootEdge,phylo4-method}
-\alias{rootNode}
-\alias{rootNode-methods}
-\alias{rootNode,phylo4-method}
-\alias{rootNode<-}
-\alias{rootNode<-,phylo4-method}
-\alias{hasNodeLabels}
-\alias{hasNodeLabels-methods}
-\alias{hasNodeLabels,phylo4-method}
-\alias{hasNodeData}
-\alias{hasNodeData-methods}
-\alias{hasNodeData,phylo4d-method}
-\alias{nodeLabels}
-\alias{nodeLabels-methods}
-\alias{nodeLabels,phylo4-method}
-\alias{nodeLabels<-}
-\alias{nodeLabels<-,phylo4,character-method}
-\alias{nodeLabels<-,phylo4d,ANY-method}
-\alias{tipLabels}
-\alias{tipLabels-methods}
-\alias{tipLabels,phylo4-method}
-\alias{tipLabels<-}
-\alias{tipLabels<-,phylo4,character-method}
-\alias{tipLabels<-,phylo4d,character-method}
-\alias{hasEdgeLabels}
-\alias{hasEdgeLabels-methods}
-\alias{hasEdgeLabels,phylo4-method}
-\alias{edgeLabels}
-\alias{edgeLabels<-}
-\alias{edgeLabels-methods}
-\alias{edgeLabels,phylo4-method}
-\alias{edgeLabels<-,phylo4,character-method}
-\alias{tdata}
-\alias{tdata<-}
-\alias{tdata-methods}
-\alias{tdata,phylo4d-method}
-\alias{tdata<-,phylo4d-method}
-\alias{addData}
-\alias{addData,phylo4-method}
-\alias{addData,phylo4d-method}
-\title{Methods for S4 phylogeny classes}
-\description{
-   Generic methods for phylogenetic trees represented as S4 classes
-}
-\section{Methods}{
-\describe{
-  \item{nTips}{\code{signature(object="phylo4")}: number of tips}
-  \item{labels}{\code{signature(object = "phylo4")}: tip labels}
-  \item{nNodes}{\code{signature(object="phylo4")}: number of internal nodes}
-  \item{hasNodeLabels}{\code{signature(object = "phylo4")}: whether
-    tree has (internal) node labels}
-  \item{hasNodeData}{\code{signature(object = "phylo4d")}: whether
-    tree has (internal) node data}
-  \item{nodeLabels}{\code{signature(object = "phylo4")}: internal
-    node labels}
-  \item{tipLabels}{\code{signature(object = "phylo4")}: tip labels}
-  \item{nEdges}{\code{signature(object = "phylo4")}: number of edges}
-  \item{edges}{\code{signature(object = "phylo4")}: edge matrix}
-  \item{hasEdgeLength}{\code{signature(object = "phylo4")}: whether
-    tree has edge (branch) lengths}
-  \item{edgeLength}{\code{signature(object = "phylo4")}: edge (branch)
-    lengths (or NULL if none)}
-  \item{hasEdgeLabels}{\code{signature(object = "phylo4")}: whether
-    tree has (internal) edge labels}
-  \item{edgeLabels}{\code{signature(object = "phylo4")}: internal
-    edge labels}
-  \item{nodeType}{\code{signature(object = "phylo4")}: named vector
-    which has the type of node (internal, tip, root) for value, and the
-    node number for name}
-
-  \item{isRooted}{\code{signature(object = "phylo4")}: whether tree is
-    rooted (i.e. has explicit root edge defined \emph{or} root node has
-    <= 2 descendants)}
-  \item{rootEdge}{\code{signature(object = "phylo4")}: root edge}
-  \item{tdata}{\code{signature(object = "phylo4d")}: trait data}
-  \item{addData}{\code{signature(x = "phylo4d")}: add data} 
-
-}
-}
-\usage{
-  \S4method{tdata}{phylo4d}(x, type=c("tip", "internal", "allnode"), label.type=c("row.names", "column"), empty.columns=TRUE, \dots)
-% what a pain: see
-% https://stat.ethz.ch/pipermail/r-devel/2008-May/049653.html
-  \S4method{tdata}{phylo4d}(object, type = "tip", \dots) <- value
-  \S4method{edgeLength}{phylo4}(x, node)
-  \S4method{edges}{phylo4}(x, order, drop.root=FALSE, \dots)
-
-  \S4method{addData}{phylo4}(x, tip.data=NULL, node.data=NULL, all.data=NULL, 
-                       pos=c("after", "before"), merge.data=TRUE, match.data=TRUE, \dots)
-
-  \S4method{addData}{phylo4d}(x, tip.data=NULL, node.data=NULL, all.data=NULL, 
-                       pos=c("after", "before"), merge.data=TRUE, match.data=TRUE, \dots)
-
-}
-\arguments{
-  \item{x}{a phylo4d object}
-  \item{object}{a phylo4d object}
-  \item{type}{which data to extract: "tip" (tips only), "node"
-    (internal nodes only), "allnode" (tips and internal nodes), "edge".}
-  \item{node}{which edge lengths to extract (indexed by descendant node)}
-  \item{label.type}{Where labels should be stored in the resulting data frame, "row.names" for using the row names of a data frame or "column" for a new column of labels to be generated. }
-  \item{empty.columns}{Logical. If TRUE data is exported as is. If FALSE, filled entirely with NAs are removed.}
-  \item{value}{a data frame}
-  \item{order}{(not yet implemented)}
-  \item{drop.root}{logical: drop root row from edge matrix?}
-  \item{tip.data}{a data frame for tips data}
-  \item{node.data}{a data frame for nodes data}
-  \item{all.data}{a data frame for all (i.e. tips and nodes) data.}
-  \item{match.data}{(logical) should the rownames of the data frame provided in
-  \code{tip.data}, \code{node.data} and/or \code{all.data} be used to be matched against
-  tip and node labels?}
-\item{merge.data}{if both \code{tip.data} and \code{node.data} are
-    provided, it determines if they should be merged as a single
-    trait (if TRUE). This argument is evaluated only if both \code{tip.data} and
-    \code{node.data} have identical column names.}  
-  \item{pos}{add data columns before or after existing data?}
-  \item{\dots}{for future development compatibility}
-}
-\examples{
-data(geospiza)
-edgeLength(geospiza,5)
-edgeLength(geospiza,"olivacea")
-edgeLength(geospiza,5:7)
-}
-\keyword{methods}

Modified: pkg/man/pdata-class.Rd
===================================================================
--- pkg/man/pdata-class.Rd	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/man/pdata-class.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -17,22 +17,30 @@
 }
 \section{Slots}{
          \describe{
-           \item{\code{data}:}{A data frame of tip or node data.  Can be
-             accessed transparently with any of the data frame accessor methods}
-           \item{\code{type}:}{A factor with length equal to \code{ncol(data)}
-             and levels ("multitype","binary","continuous","DNA","RNA","aacid")}
-           \item{\code{comment}:}{A character vector of length \code{ncol(data)}}
-           \item{\code{metadata}:}{An arbitrary list, for storing other user-defined metadata}
+           \item{\code{data}:}{A data frame of tip or node data.  Can be 
+             accessed transparently with any of the data frame accessor
+	     methods} 
+           \item{\code{type}:}{A factor with length equal to
+	     \code{ncol(data)} and levels("multitype", "binary",
+	     "continuous", "DNA", "RNA", "aacid")} 
+           \item{\code{comment}:}{A character vector of length
+	     \code{ncol(data)}} 
+           \item{\code{metadata}:}{An arbitrary list, for storing other
+	     user-defined metadata} 
 }
 }
 \section{Methods}{
   \describe{
-    \item{[}{\code{signature(x = "pdata")}: access data rows, columns or elements}
-    \item{[<-}{\code{signature(x = "pdata")}: set data rows, columns or elements}
-    \item{[[<-}{\code{signature(x = "pdata")}: set data columns or elements}
-    \item{[[}{\code{signature(x = "pdata", i = "ANY", j = "ANY")}: access data columns or elements }
-    \item{[[}{\code{signature(x = "pdata", i = "ANY", j = "missing")}: set data columns
-    or elements }
+    \item{[}{\code{signature(x = "pdata")}: access data rows, columns or
+      elements} 
+    \item{[<-}{\code{signature(x = "pdata")}: set data rows, columns or
+      elements} 
+    \item{[[<-}{\code{signature(x = "pdata")}: set data columns or
+      elements} 
+    \item{[[}{\code{signature(x = "pdata", i = "ANY", j = "ANY")}:
+      access data columns or elements } 
+    \item{[[}{\code{signature(x = "pdata", i = "ANY", j = "missing")}:
+      set data columns or elements }
     }
 }
 \author{Ben Bolker}

Copied: pkg/man/phylo4-accessors.Rd (from rev 582, pkg/man/nNodes-methods.Rd)
===================================================================
--- pkg/man/phylo4-accessors.Rd	                        (rev 0)
+++ pkg/man/phylo4-accessors.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -0,0 +1,110 @@
+\name{phylo4-accessors}
+\docType{methods}
+\alias{nNodes}
+\alias{nNodes-methods}
+\alias{nNodes,phylo4-method}
+\alias{nTips}
+\alias{nTips-methods}
+\alias{nTips,phylo4-method}
+\alias{nTips,ANY-method}
+\alias{edges}
+\alias{edges-methods}
+\alias{edges,phylo4-method}
+\alias{nEdges}
+\alias{nEdges-methods}
+\alias{nEdges,phylo4-method}
+\alias{edgeOrder}
+\alias{edgeOrder,phylo4-method}
+\alias{hasEdgeLength}
+\alias{hasEdgeLength-methods}
+\alias{hasEdgeLength,phylo4-method}
+\alias{edgeLength}
+\alias{edgeLength-methods}
+\alias{edgeLength,phylo4-method}
+\alias{edgeLength<-}
+\alias{edgeLength<-,phylo4-method}
+\alias{edgeLength<-,phylo4,ANY-method}
+\alias{nodeType}
+\alias{nodeType,phylo4-method}
+\alias{isRooted}
+\alias{isRooted-methods}
+\alias{isRooted,phylo4-method}
+\alias{rootEdge}
+\alias{rootEdge-methods}
+\alias{rootEdge,phylo4-method}
+\alias{rootNode}
+\alias{rootNode-methods}
+\alias{rootNode,phylo4-method}
+\alias{rootNode<-}
+\alias{rootNode<-,phylo4-method}
+\title{Methods for S4 phylogeny classes}
+\description{
+   Generic methods for phylogenetic trees represented as S4 classes
+}
+\section{Methods}{
+\describe{
+  \item{nTips}{\code{signature(object="phylo4")}: number of tips}
+  
+  \item{nNodes}{\code{signature(object="phylo4")}: number of internal nodes}
+  
+  \item{nEdges}{\code{signature(object = "phylo4")}: number of edges}
+  
+  \item{edges}{\code{signature(object = "phylo4")}: returns the edge
+  matrix} 
+  
+  \item{hasEdgeLength}{\code{signature(object = "phylo4")}: whether
+    tree has edge (branch) lengths}
+  
+  \item{edgeLength}{\code{signature(object = "phylo4")}: edge (branch)
+    lengths (or NULL if none)}
+ 
+  \item{nodeType}{\code{signature(object = "phylo4")}: named vector
+    which has the type of node (internal, tip, root) for value, and the
+    node number for name}
+
+  \item{isRooted}{\code{signature(object = "phylo4")}: whether tree is
+    rooted (i.e. has explicit root edge defined \emph{or} root node has
+    <= 2 descendants)}
+  
+  \item{rootEdge}{\code{signature(object = "phylo4")}: root edge}
+  }
+}
+
+\usage{
+% what a pain: see
+% https://stat.ethz.ch/pipermail/r-devel/2008-May/049653.html
+\S4method{nNodes}{phylo4}(x)
+\S4method{nTips}{phylo4}(x)
+\S4method{edges}{phylo4}(x, order, drop.root=FALSE)
+\S4method{nEdges}{phylo4}(x)
+\S4method{edgeOrder}{phylo4}(x)
+\S4method{hasEdgeLength}{phylo4}(x)
+\S4method{edgeLength}{phylo4}(x, node)
+\S4method{edgeLength}{phylo4}(x, use.names=TRUE) <- value
+\S4method{nodeType}{phylo4}(phy)
+\S4method{isRooted}{phylo4}(x)
+\S4method{rootEdge}{phylo4}(x)
+\S4method{rootNode}{phylo4}(x)
+\S4method{rootNode}{phylo4}(x) <- value
+}
+
+\arguments{
+  \item{x}{a phylo4/phylo4d object}
+  \item{phy}{a phylo4/phylo4d object}
+  \item{node}{which edge lengths to extract (indexed by descendant
+    node)} 
+  \item{value}{a vector of edge lengths or a node number}
+  \item{order}{(not yet implemented)}
+  \item{use.names}{Should the names of \code{value} be used to match
+  edge lengths provided? }
+  \item{drop.root}{logical: drop root row from edge matrix?}
+}
+
+\examples{
+data(geospiza)
+edgeLength(geospiza,5)
+edgeLength(geospiza,"olivacea")
+edgeLength(geospiza,5:7)
+}
+
+\keyword{methods}


Property changes on: pkg/man/phylo4-accessors.Rd
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: pkg/man/phylo4-labels.Rd
===================================================================
--- pkg/man/phylo4-labels.Rd	                        (rev 0)
+++ pkg/man/phylo4-labels.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -0,0 +1,133 @@
+\name{labels-phylo4}
+\docType{methods}
+\alias{labels<-}
+\alias{labels,phylo4-method}
+\alias{labels<-,phylo4,ANY,ANY,character-method}
+\alias{labels<-,phylo4d,ANY,ANY,character-method}
+\alias{hasNodeLabels}
+\alias{hasNodeLabels-methods}
+\alias{hasNodeLabels,phylo4-method}
+\alias{nodeLabels}
+\alias{nodeLabels-methods}
+\alias{nodeLabels,phylo4-method}
+\alias{nodeLabels<-}
+\alias{nodeLabels<-,phylo4,character-method}
+\alias{nodeLabels<-,phylo4d,ANY-method}
+\alias{tipLabels}
+\alias{tipLabels-methods}
+\alias{tipLabels,phylo4-method}
+\alias{tipLabels<-}
+\alias{tipLabels<-,phylo4,character-method}
+\alias{tipLabels<-,phylo4d,character-method}
+\alias{hasEdgeLabels}
+\alias{hasEdgeLabels-methods}
+\alias{hasEdgeLabels,phylo4-method}
+\alias{edgeLabels}
+\alias{edgeLabels<-}
+\alias{edgeLabels-methods}
+\alias{edgeLabels,phylo4-method}
+\alias{edgeLabels<-,phylo4,character-method}
+
+\title{Labels for phylo4/phylo4d objects}
+
+\description{Methods for creating, accessing and updating labels in
+  phylo4/phylo4d objects}
+
+\usage{
+
+\S4method{labels}{phylo4}(x, type=c("tip", "internal", "allnode"))
+\S4method{labels}{phylo4,ANY,ANY,character}(x, type=c("tip", "internal", "allnode"),
+use.names=FALSE) <- value
+
+\S4method{tipLabels}{phylo4}(object)
+\S4method{tipLabels}{phylo4,character}(object) <- value
+
+\S4method{hasNodeLabels}{phylo4}(x)
+\S4method{nodeLabels}{phylo4}(object)
+\S4method{nodeLabels}{phylo4,character}(object) <- value
+
+\S4method{hasEdgeLabels}{phylo4}(x)
+\S4method{edgeLabels}{phylo4}(x)
+\S4method{edgeLabels}{phylo4,character}(x) <- value
+
+}
+
+\arguments{
+  \item{x}{a phylo4 or phylo4d object.}
+  \item{object}{a phylo4 or phylo4d object.}
+  \item{type}{which type of labels: \code{tip} (tips), \code{internal}
+  (internal nodes), \code{allnode} (tips and internal nodes).}
+  \item{value}{a vector of class \code{character}, see Details for more
+    information.}
+  \item{use.names}{should the names of the vector used to create/update
+    labels be used to match the labels? See Details for more information.}
+  
+}
+
+\details{
+
+  In phylo4/phylo4d objects, tips must have labels (that's why there is
+  no method for hasTipLabels), internal nodes and edges can have
+  labels. 
+
+  Labels must be provided as a vector of class \code{character}. The
+  length of the vector must match the number of elements they label.
+
+  The option \code{use.names} allows the user to match a label to a
+  particular node. In this case, the vector must have names that match
+  the node numbers.
+
+  The function \code{labels} is mostly intended to be used
+  internally.  
+
+}
+
+\section{Methods}{
+  \describe{
+    \item{labels}{\code{signature(object = "phylo4")}: tip labels}
+
+    \item{tipLabels}{\code{signature(object = "phylo4")}: tip labels}
+    
+    \item{hasNodeLabels}{\code{signature(object = "phylo4")}: whether
+      tree has (internal) node labels}
+    \item{nodeLabels}{\code{signature(object = "phylo4")}: internal
+      node labels}
+    
+    \item{hasEdgeLabels}{\code{signature(object = "phylo4")}: whether
+    tree has (internal) edge labels}
+    \item{edgeLabels}{\code{signature(object = "phylo4")}: internal
+      edge labels}
+  }
+}
+
+\examples{
+
+data(geospiza)
+
+## Return labels from geospiza
+tipLabels(geospiza)
+
+## Internal node labels in geospiza are empty
+nodeLabels(geospiza)
+
+## Creating internal node labels
+ndLbl <- paste("n", 1:nNodes(geospiza), sep="")
+nodeLabels(geospiza) <- ndLbl
+nodeLabels(geospiza)
+
+## naming the labels
+names(ndLbl) <- nodeId(geospiza, "internal")
+
+## shuffling the labels
+(ndLbl <- sample(ndLbl))
+
+## by default, the labels are attributed in the order
+## they are given:
+nodeLabels(geospiza) <- ndLbl
+nodeLabels(geospiza)
+
+## but use.names puts them in the correct order
+labels(geospiza, "internal", use.names=TRUE) <- ndLbl
+nodeLabels(geospiza)
+
+}
\ No newline at end of file

Modified: pkg/man/phylo4d-class.Rd
===================================================================
--- pkg/man/phylo4d-class.Rd	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/man/phylo4d-class.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -8,6 +8,20 @@
 \alias{summary,phylo4d-method}
 \alias{phylo4d,phylo4d-method}
 \alias{names,phylo4d-method}
+\alias{hasNodeData}
+\alias{hasNodeData-methods}
+\alias{hasNodeData,phylo4d-method}
+\alias{hasTipData}
+\alias{hasTipData-methods}
+\alias{hasTipData,phylo4d-method}
+\alias{tdata}
+\alias{tdata<-}
+\alias{tdata-methods}
+\alias{tdata,phylo4d-method}
+\alias{tdata<-,phylo4d-method}
+\alias{addData}
+\alias{addData,phylo4-method}
+\alias{addData,phylo4d-method}
 \alias{[,phylo4d,ANY,ANY,ANY-method}
 \title{phylo4d class}
 \description{S4 class for phylogenetic tree and data.}
@@ -42,13 +56,20 @@
     \item{names}{\code{signature(x = "phylo4d")}: gives the slots names}
     \item{head}{\code{signature(object = "phylo4d")}: show first few
 nodes}
-    \item{tail}{\code{signature(object = "phylo4d")}: show last few nodes}
+    \item{tail}{\code{signature(object = "phylo4d")}: show last few
+nodes}
+ \item{hasNodeData}{\code{signature(object = "phylo4d")}: whether
+   tree has internal node data}
+ \item{hasTipData}{TODO}
   }
 }
 \usage{
     \S4method{print}{phylo4d}(x, edgeOrder = c("pretty", "real"), printall=TRUE)
     \S4method{summary}{phylo4d}(object)
     \S4method{names}{phylo4d}(x)
+\S4method{tdata}{phylo4d}(x, type=c("tip", "internal", "allnode"),
+label.type=c("row.names", "column"), empty.columns=TRUE, \dots)
+ \S4method{tdata}{phylo4d}(object, type = "tip", \dots) <- value
   }
   \arguments{
     \item{x}{a phylo4d object}
@@ -56,6 +77,11 @@
     \item{edgeOrder}{Character string indicating whether the edges should be printed
       as ordered in the tree "real" (e.g. preorder or postorder), or "pretty" printed 
       with tips collated together}
+    \item{type}{TODO}
+    \item{label.type}{TODO}
+    \item{empty.columns}{TODO}
+    \item{\dots}{TODO}
+    \item{value}{TODO}
     \item{printall}{If TRUE all tip labels are printed}
   }
   \value{

Modified: pkg/man/phylo4d.Rd
===================================================================
--- pkg/man/phylo4d.Rd	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/man/phylo4d.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -142,5 +142,43 @@
 (exGeo7 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=FALSE))
 (exGeo8 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=FALSE, match.data=FALSE))
 
+require(ape) ## for rcoal
+## generate a tree and some data
+set.seed(1)
+p3 <- rcoal(5)
+dat <- data.frame(a = rnorm(5), b = rnorm(5), row.names = p3$tip.label)
+dat.defaultnames <- dat
+row.names(dat.defaultnames) <- NULL
+dat.superset <- rbind(dat, rnorm(2))
+dat.subset <- dat[-1, ]
+
+## create a phylo4 object from a phylo object
+p4 <- as(p3, "phylo4")
+
+## create phylo4d objects with tip data
+p4d <- phylo4d(p4, dat)
+###checkData(p4d)
+p4d.sorted <- phylo4d(p4, dat[5:1, ])
+try(p4d.nonames <- phylo4d(p4, dat.defaultnames))
+p4d.nonames <- phylo4d(p4, dat.defaultnames, match.data=FALSE)
+
+\dontrun{
+p4d.subset <- phylo4d(p4, dat.subset)
+p4d.subset <- phylo4d(p4, dat.subset)
+try(p4d.superset <- phylo4d(p4, dat.superset))
+p4d.superset <- phylo4d(p4, dat.superset)
 }
+
+## create phylo4d objects with node data
+nod.dat <- data.frame(a = rnorm(4), b = rnorm(4))
+p4d.nod <- phylo4d(p4, node.data = nod.dat, match.data=FALSE)
+
+
+## create phylo4 objects with node and tip data
+p4d.all1 <- phylo4d(p4, node.data = nod.dat, tip.data = dat, match.data=FALSE)
+nodeLabels(p4) <- as.character(sort(nodeId(p4)))
+p4d.all2 <- phylo4d(p4, all.data = rbind(dat, nod.dat, match.data=FALSE))
+
+
+}
 \keyword{misc}

Modified: pkg/man/phylobase-package.Rd
===================================================================
--- pkg/man/phylobase-package.Rd	2009-08-25 00:03:18 UTC (rev 582)
+++ pkg/man/phylobase-package.Rd	2009-08-25 00:51:06 UTC (rev 583)
@@ -15,7 +15,10 @@
         Depends:    \tab methods, grid, ape(>= 2.1)\cr
         Suggests:   \tab ade4, MASS\cr
         License:    \tab GPL Version 2 or later\cr
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/phylobase -r 583


More information about the Phylobase-commits mailing list