[Phylobase-commits] r429 - in pkg: inst/doc man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 22 01:50:38 CEST 2009


Author: pdc
Date: 2009-04-22 01:50:38 +0200 (Wed, 22 Apr 2009)
New Revision: 429

Modified:
   pkg/inst/doc/phylobase.Rnw
   pkg/man/phylo4-class.Rd
Log:
Update docs to reflect last changeset.  
vignette source also reformatted

Modified: pkg/inst/doc/phylobase.Rnw
===================================================================
--- pkg/inst/doc/phylobase.Rnw	2009-04-21 23:44:13 UTC (rev 428)
+++ pkg/inst/doc/phylobase.Rnw	2009-04-21 23:50:38 UTC (rev 429)
@@ -1,16 +1,19 @@
 \documentclass{article}
 %\VignettePackage{phylo4}
-% \VignetteIndexEntry{phylo4: classes and methods for phylogenetic trees and data}
+%\VignetteIndexEntry{phylo4: classes and methods for phylogenetic trees and data}
+
+\usepackage[utf8]{inputenc} % for UTF-8/single quotes from sQuote()
 \usepackage{graphicx}
-\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
 \usepackage{array}
 \usepackage{color}
+\usepackage[colorlinks=true,urlcolor=blue,bookmarks=true]{hyperref}
 
-\usepackage[utf8]{inputenc} % for UTF-8/single quotes from sQuote()
 \newcommand{\code}[1]{{{\tt #1}}}
+
 \title{The \code{phylo4} S4 classes and methods}
 \author{Ben Bolker \& Peter Cowan}
 \date{\today}
+
 \begin{document}
 \maketitle
 \tableofcontents
@@ -19,30 +22,9 @@
 
 This document describes the new \code{phylo4} S4 classes and methods, which are intended to provide a unifying standard for the representation of phylogenetic trees and comparative data in R.  The \code{phylobase} package was developed to help both end users and package developers by providing a common suite of tools likely to be shared by all packages designed for phylogenetic analysis, facilities for data and tree manipulation, and standardization of formats.
 
-This standardization will benefit \emph{end-users}
-by making it easier to move data and compare analyses
-across packages, and to keep comparative data synchronized with
-phylogenetic trees.
-Users will also benefit from
-a repository of functions
-for tree manipulation,
-for example tools for including or excluding subtrees (and associated phenotypic data) or improved tree and data plotting facilities.
-\code{phylobase} will benefit \emph{developers}
-by freeing them to put their programming effort into
-developing new methods rather than into re-coding base tools.
-We (the \code{phylobase} developers)
-hope \code{phylobase} will also
-facilitate code validation by providing a repository
-for benchmark tests, and more generally
-that it will help catalyze community development
-of comparative methods in R.
+This standardization will benefit \emph{end-users} by making it easier to move data and compare analyses across packages, and to keep comparative data synchronized with phylogenetic trees. Users will also benefit from a repository of functions for tree manipulation, for example tools for including or excluding subtrees (and associated phenotypic data) or improved tree and data plotting facilities. \code{phylobase} will benefit \emph{developers} by freeing them to put their programming effort into developing new methods rather than into re-coding base tools. We (the \code{phylobase} developers) hope \code{phylobase} will also facilitate code validation by providing a repository for benchmark tests, and more generally that it will help catalyze community development of comparative methods in R.
 
-A more abstract motivation for
-developing \code{phylobase} was to improve
-data checking and abstraction of the tree data formats.
-\code{phylobase} can check that data and trees are associated in the proper fashion, and protects users and developers from accidently reordering one, but not the other.  It
-also seeks to abstract the data format so that commonly used information (for example, branch length information or the ancestor of a particular node) can be accessed without knowledge of
-the underlying data structure (i.e., whether the tree is stored as a matrix, or a list, or a parenthesis-based format).  This is achieved through generic \code{phylobase} functions which which retrieve the relevant information from the data structures. The benefits of such abstraction are multiple: (1) \emph{easier access to the relevant information} via a simple function call (this frees both users and developers from learning details of complex data structures), (2) \emph{freedom to optimize data structures in the future without breaking code.}  Having the generic functions in place to ``translate'' between the data structures and the rest of the program code allows program and data structure development to proceed somewhat independently. The alternative is code written for specific data structures, in which modifications to the data structure requires rewriting the entire package code (often exacting too high a price, which results in the persistence of less-optimal data structures).  (3) \emph{providing broader access to the range of tools in \code{phylobase}}. Developers of specific packages can use these new tools based on S4 objects without knowing the details of S4 programming.
+A more abstract motivation for developing \code{phylobase} was to improve data checking and abstraction of the tree data formats. \code{phylobase} can check that data and trees are associated in the proper fashion, and protects users and developers from accidently reordering one, but not the other. It also seeks to abstract the data format so that commonly used information (for example, branch length information or the ancestor of a particular node) can be accessed without knowledge of the underlying data structure (i.e., whether the tree is stored as a matrix, or a list, or a parenthesis-based format). This is achieved through generic \code{phylobase} functions which which retrieve the relevant information from the data structures. The benefits of such abstraction are multiple: (1) \emph{easier access to the relevant information} via a simple function call (this frees both users and developers from learning details of complex data structures), (2) \emph{freedom to optimize data structures in the future without breaking code.} Having the generic functions in place to ``translate'' between the data structures and the rest of the program code allows program and data structure development to proceed somewhat independently. The alternative is code written for specific data structures, in which modifications to the data structure requires rewriting the entire package code (often exacting too high a price, which results in the persistence of less-optimal data structures). (3) \emph{providing broader access to the range of tools in \code{phylobase}}. Developers of specific packages can use these new tools based on S4 objects without knowing the details of S4 programming.
 
 The base \code{phylo4} class is modeled on the the \code{phylo} class in \code{ape}.  \code{phylo4d} and \code{multiphylo4} extend the \code{phylo4} class to include data or multiple trees respectively.  In addition to describing the classes and methods, this vignette gives examples of how they might be used.
 
@@ -95,19 +77,15 @@
         > method?plot("phylo4")
 \end{verbatim}
 
-More information about how \code{S4} documentation works
-can be found in the methods package, by running the following command.
+More information about how \code{S4} documentation works can be found in the methods package, by running the following command.
 
 <<doc,eval=FALSE>>=
-help('Documentation', package = "methods")
+help('Documentation', package="methods")
 @
 
 \section{Trees without data}
 
-You can start with a tree --- an object of
-class \code{phylo} from the \code{ape} package
-(e.g., read in using the \code{read.tree()} or \code{read.nexus()}
-functions), and convert it to a \code{phylo4} object.
+You can start with a tree --- an object of class \code{phylo} from the \code{ape} package (e.g., read in using the \code{read.tree()} or \code{read.nexus()} functions), and convert it to a \code{phylo4} object.
 
 For example, load the raw \emph{Geospiza} data:
 <<geodata>>=
@@ -118,26 +96,26 @@
 
 Convert the \code{S3} tree to a \code{S4 phylo4} object using the \code{as()} function:
 <<convgeodata>>=
-(g1 <- as(geospiza_raw$tree,"phylo4"))
+(g1 <- as(geospiza_raw$tree, "phylo4"))
 @
 
-The nodes appear with labels \verb+<NA>+ because their labels
-are missing:
+The nodes appear with labels \verb+<NA>+ because their labels are missing:
+
 <<nodelabelgeodata>>=
 nodeLabels(g1)
 @
-(you can also retrieve the node labels with
-\code{labels(g1,"internal")}).
 
-A simple way to assign the node numbers as
-labels (useful for various checks) is
+(you can also retrieve the node labels with \code{labels(g1,"internal")}).
+
+A simple way to assign the node numbers as labels (useful for various checks) is
+
 <<>>=
 nodeLabels(g1) <- as.character(sort(nodeId(g1)))
-head(g1,5)
+head(g1, 5)
 @
 
-
 The \code{summary} method gives a little extra information, including information on branch lengths:
+
 <<sumgeodata>>=
 summary(g1)
 @
@@ -151,7 +129,7 @@
 
 Print node numbers (in edge matrix order):
 <<nodenumbergeodata>>=
-nodeId(g1, which = 'allnode')
+nodeId(g1, which='allnode')
 @
 
 Print edge labels (also empty in this case):
@@ -179,64 +157,54 @@
 hasEdgeLength(g1)
 @
 
-You can modify labels and other aspects
-of the tree --- for example, to convert
-all the labels to lower case:
+You can modify labels and other aspects of the tree --- for example, to convert all the labels to lower case:
+
 <<modlabelsgeodata>>=
 tipLabels(g1) <- tolower(tipLabels(g1))
 @
 
-You could also modify selected labels, e.g.
-to modify the labels in positions 11 and 13
-(which happen to be the only labels with uppercase letters):
+You could also modify selected labels, e.g. to modify the labels in positions 11 and 13 (which happen to be the only labels with uppercase letters):
+
 <<eval=FALSE>>=
-tipLabels(g1)[c(11,13)] <- c("platyspiza","pinaroloxias")
+tipLabels(g1)[c(11, 13)] <- c("platyspiza", "pinaroloxias")
 @
 
 \section{Trees with data}
 
-The \code{phylo4d} class matches trees with data,
-or combines them with a data frame to make a \code{phylo4d} (tree-with-data)
-object.
+The \code{phylo4d} class matches trees with data, or combines them with a data frame to make a \code{phylo4d} (tree-with-data) object.
 
-Now we'll take the \emph{Geospiza} data from \verb+geospiza_raw$data+
-and merge it with the tree.  However, since \emph{G. olivacea} is included
-in the tree but not in the data set, we will initially run into some trouble:
+Now we'll take the \emph{Geospiza} data from \verb+geospiza_raw$data+ and merge it with the tree. However, since \emph{G. olivacea} is included in the tree but not in the data set, we will initially run into some trouble:
 
 <<geomergedata,eval=FALSE>>=
-g2 <- phylo4d(g1,geospiza_raw$data)
+g2 <- phylo4d(g1, geospiza_raw$data)
 @
 
 gives
 <<geomergeerr1,echo=FALSE>>=
-err1 <- try(g2 <- phylo4d(g1,geospiza_raw$data),silent=TRUE)
+err1 <- try(g2 <- phylo4d(g1, geospiza_raw$data), silent=TRUE)
 cat(as.character(err1))
 @
 
-We have two problems --- the first is that we forgot to lowercase
-the labels on the data to match the tip labels:
+We have two problems --- the first is that we forgot to lowercase the labels on the data to match the tip labels:
 
 <<geomergenames>>=
 gdata <- geospiza_raw$data
 row.names(gdata) <- tolower(row.names(gdata))
 @
 
-To deal with the second problem
-(missing data for \emph{G. olivacea}), we have a few choices.
-The easiest is to use \code{missing.tip.data="OK"}
-to allow R to create the new object:
+To deal with the second problem (missing data for \emph{G. olivacea}), we have a few choices. The easiest is to use \code{missing.tip.data="OK"} to allow R to create the new object:
+
 <<geomerge2>>=
-g2 <- phylo4d(g1,gdata,missing.tip.data="OK")
+g2 <- phylo4d(g1, gdata,missing.tip.data="OK")
 @
-(setting \code{missing.tip.data} to \code{"warn"}
-would create the new object but print a warning).
 
-Another way to deal with this would be to
-use \code{prune()} to drop
-the offending tip from the tree first:
+(setting \code{missing.tip.data} to \code{"warn"} would create the new object but print a warning).
+
+Another way to deal with this would be to use \code{prune()} to drop the offending tip from the tree first:
+
 <<geomerge3,results=hide>>=
-g1B <- prune(g1,"olivacea")
-phylo4d(g1B,gdata)
+g1B <- prune(g1, "olivacea")
+phylo4d(g1B, gdata)
 @
 
 You can summarize the new object:
@@ -244,7 +212,7 @@
 summary(g2)
 @
 
-Or use \code{tdata()} to extract the data (i.e., \code{tdata(g2)}). By default, \code{tdata()} will retrieve tip data, but you can also get internal node data only (\code{tdata(tree,"internal")}) or --- if the tip and node data have the same format --- all the data combined (\code{tdata(tree,"allnode")}).
+Or use \code{tdata()} to extract the data (i.e., \code{tdata(g2)}). By default, \code{tdata()} will retrieve tip data, but you can also get internal node data only (\code{tdata(tree, "internal")}) or --- if the tip and node data have the same format --- all the data combined (\code{tdata(tree, "allnode")}).
 
 %Plotting calls \code{plot.phylog} from the \code{ade4} package.
 
@@ -264,17 +232,17 @@
 Different ways to extract the \emph{fuliginosa}-\emph{scandens}
 clade:
 <<geoextract,results=hide>>=
-subset(g2,tips.include=c("fuliginosa","fortis","magnirostris",
-            "conirostris","scandens"))
-subset(g2,node.subtree=21)
-subset(g2,mrca=c("scandens","fortis"))
+subset(g2, tips.include=c("fuliginosa", "fortis", "magnirostris",
+            "conirostris", "scandens"))
+subset(g2, node.subtree=21)
+subset(g2, mrca=c("scandens", "fortis"))
 @
 
 One could drop the clade by  doing
 <<geodrop,results=hide>>=
-subset(g2,tips.exclude=c("fuliginosa","fortis","magnirostris",
-            "conirostris","scandens"))
-subset(g2,tips.exclude=names(descendants(g2,MRCA(g2,c("difficilis","fortis")))))
+subset(g2, tips.exclude=c("fuliginosa", "fortis", "magnirostris",
+            "conirostris", "scandens"))
+subset(g2, tips.exclude=names(descendants(g2 ,MRCA(g2, c("difficilis", "fortis")))))
 @
 
 % This isn't implemented yet
@@ -293,10 +261,9 @@
 \code{descendants}, \code{ancestors},
 \code{siblings},
 \code{MRCA} \ldots
-generally take a \code{phylo4} object, a node
-(specified by number or name) and return a named
-vector of node numbers.
 
+generally take a \code{phylo4} object, a node (specified by number or name) and return a named vector of node numbers.
+
 \section{multiPhylo classes}
 
 Fix me!
@@ -304,53 +271,32 @@
 
 \subsection{Constructing a Brownian motion trait simulator}
 
-This section will describe two (?) ways of constructing
-a simulator that generates trait values for extant species
-(tips) given a tree with branch lengths, assuming a model
-of Brownian motion.
+This section will describe two (?) ways of constructing a simulator that generates trait values for extant species (tips) given a tree with branch lengths, assuming a model of Brownian motion.
 
 \subsubsection{the easy way}
 
-We can use \code{as(tree,"phylo4vcov")} to
-coerce the tree into a variance-covariance matrix
-form, and then 
-use \code{mvrnorm} from the \code{MASS} package
-to generate a set of multivariate normally distributed
-values for the tips. (A benefit of this approach is
-that we can very quickly generate a very large
-number of replicates.)
-This example illustrates a common feature of
-working with \code{phylobase} --- combining tools from
-several different packages to operate on phylogenetic
-trees with data.
+We can use \code{as(tree,"phylo4vcov")} to coerce the tree into a variance-covariance matrix form, and then use \code{mvrnorm} from the \code{MASS} package to generate a set of multivariate normally distributed values for the tips. (A benefit of this approach is that we can very quickly generate a very large number of replicates.) This example illustrates a common feature of working with \code{phylobase} --- combining tools from several different packages to operate on phylogenetic trees with data.
 
-We start with a randomly generated tree using
-\code{rcoal()} from \code{ape} to generate the
-tree topology and branch lengths:
+We start with a randomly generated tree using \code{rcoal()} from \code{ape} to generate the tree topology and branch lengths:
+
 <<rtree2>>=
 set.seed(1001)
-tree <- as(rcoal(12),"phylo4")
+tree <- as(rcoal(12), "phylo4")
 @
 
-Next we generate the phylogenetic variance-covariance
-matrix (by coercing the tree to 
-a \code{phylo4vcov} object) and pick a single set
-of normally distributed traits (using \code{MASS:mvrnorm}
-to pick a multivariate normal deviate with a
-variance-covariance matrix that matches the 
-structure of the tree).
+Next we generate the phylogenetic variance-covariance matrix (by coercing the tree to a \code{phylo4vcov} object) and pick a single set of normally distributed traits (using \code{MASS:mvrnorm} to pick a multivariate normal deviate with a variance-covariance matrix that matches the structure of the tree).
+
 <<vcvphylo>>=
-vmat <- as(tree,"phylo4vcov")
+vmat <- as(tree, "phylo4vcov")
 vmat <- cov2cor(vmat)
 library(MASS)
-trvec <- mvrnorm(1,mu=rep(0,12),Sigma=vmat)
+trvec <- mvrnorm(1, mu=rep(0, 12), Sigma=vmat)
 @
 
-The last step (easy) is to 
-convert the \code{phylo4vcov} object
-back to a \code{phylo4d} object:
+The last step (easy) is to convert the \code{phylo4vcov} object back to a \code{phylo4d} object:
+
 <<plotvcvphylo,fig=TRUE>>=
-treed <- phylo4d(tree,tip.data=as.data.frame(trvec))
+treed <- phylo4d(tree, tip.data=as.data.frame(trvec))
 plot(treed)
 @
 
@@ -361,23 +307,23 @@
 nodeLabels(tree) <- as.character(sort(nodeId(tree)))
 ## ordering will make sure that we have ancestor value 
 ## defined before descendant
-tree <- reorder(tree,"preorder")
+tree <- reorder(tree, "preorder")
 edgemat <- edges(tree)
 ## set aside space for values
 nodevals <- numeric(nrow(edgemat))
 ## label data in edge matrix order
-names(nodevals) <- labels(tree,"all")[nodeId(tree,"all")]
+names(nodevals) <- labels(tree, "all")[nodeId(tree, "all")]
 ## variance is proportional to edge length; drop first
 ## element of edge length, which is NA
-dvals <- rnorm(nrow(edgemat)-1,sd=edgeLength(tree)[-1]^2)
+dvals <- rnorm(nrow(edgemat) - 1, sd=edgeLength(tree)[-1]^2)
 ## indexing: ind[node number] gives position in edge matrix
-ind <- order(nodeId(tree,"all"))
+ind <- order(nodeId(tree, "all"))
 for (i in 2:nrow(edgemat)) {
   ## value of ancestor node plus change
-  nodevals[i] <- nodevals[ind[edgemat[i,1]]]+dvals[i-1]
+  nodevals[i] <- nodevals[ind[edgemat[i, 1]]] + dvals[i - 1]
   }
 nodevals <- data.frame(nodevals)
-treed2 <- phylo4d(tree,all.data=nodevals)
+treed2 <- phylo4d(tree, all.data=nodevals)
 @ 
 
 
@@ -403,16 +349,7 @@
 
 This section details the internal structure of the \code{phylo4}, \code{multiphylo4}, \code{phylo4d}, and \code{multiphylo4d} classes.  The basic building blocks of these classes are the \code{phylo4} object and a dataframe.  The \code{phylo4} tree format is largely similar to the one used by \code{phylo} class in the package \code{ape} \footnote{\url{http://ape.mpl.ird.fr/}}.
 
-We use ``edge'' for ancestor-descendant relationships
-in the phylogeny (sometimes
-called ``branches'') and ``edge lengths'' for their
-lengths (``branch lengths'').  Most generally,
-``nodes'' are all species in the tree;
-species with descendants are ``internal nodes'' (we
-often refer to these just as ``nodes'', meaning clear
-from context); ``tips'' are species with
-no descendants. The ``root node'' is the node
-with no ancestor (if one exists).
+We use ``edge'' for ancestor-descendant relationships in the phylogeny (sometimes called ``branches'') and ``edge lengths'' for their lengths (``branch lengths''). Most generally, ``nodes'' are all species in the tree; species with descendants are ``internal nodes'' (we often refer to these just as ``nodes'', meaning clear from context); ``tips'' are species with no descendants. The ``root node'' is the node with no ancestor (if one exists).
 
 \subsection{phylo4}
 Like \code{phylo}, the main components of
@@ -431,25 +368,13 @@
 \item[node.label]{character vector of node labels, length=\# of
     internal nodes or 0 (if empty).  Node labels need not be unique, but data-tree matching with non-unique labels will cause an error}
 \item[order]{character: ``preorder'', ``postorder'', or ``unknown''
-    (default), describing the order of rows in the edge matrix}
+    (default), describing the order of rows in the edge matrix.  , ``pruningwise'' and ``cladewise'' are accepted for compatibility with \code{ape}}
 \end{description}
 
-The edge matrix must not contain \code{NA}s, with the exception
-of the root node, which has an \code{NA} for \code{ancestor}.
-\code{phylobase} does not enforce an order on the rows of the
-edge matrix, but it stores information on the current ordering
-in the \code{@order} slot --- current allowable values are
-``unknown'' (the default), ``preorder'' (equivalent to ``cladewise''
-in \code{ape}) or ``postorder'': see
-\url{http://en.wikipedia.org/wiki/Tree_traversal} for
-more information on orderings.  (\code{ape}'s ``pruningwise''
-is ``bottom-up'' ordering.)
+The edge matrix must not contain \code{NA}s, with the exception of the root node, which has an \code{NA} for \code{ancestor}. \code{phylobase} does not enforce an order on the rows of the edge matrix, but it stores information on the current ordering in the \code{@order} slot --- current allowable values are ``unknown'' (the default), ``preorder'' (equivalent to ``cladewise'' in \code{ape}) or ``postorder'': see \url{http://en.wikipedia.org/wiki/Tree_traversal} for more information on orderings. (\code{ape}'s ``pruningwise'' is ``bottom-up'' ordering.)
 
-The basic criteria for the edge matrix are taken from
-\code{ape}, as documented in
-\url{ape.mpl.ird.fr/misc/FormatTreeR_28July2008.pdf}.
-This is a modified version of those rules, for
-a tree with $n$ tips and $m$ internal nodes:
+The basic criteria for the edge matrix are taken from \code{ape}, as documented in \url{ape.mpl.ird.fr/misc/FormatTreeR_28July2008.pdf}. This is a modified version of those rules, for a tree with $n$ tips and $m$ internal nodes:
+
 \begin{itemize}
 \item Tips (no descendants) are coded $1,\ldots, n$,
   and internal nodes ($\ge 1 descendant$)
@@ -459,32 +384,18 @@
 \item The first (ancestor)
   column has only values $> n$ (internal nodes): thus, values $\le n$
   (tips) appear only in the second (descendant) column)
-\item all internal nodes [not including the root]
-  must appear in the first (ancestor) column
-  at least once [unlike \code{ape}, which nominally requires each internal node to have at least two descendants (although it doesn't
-absolutely prohibit them and has a \code{collapse.singles} function to get rid of them), \code{phylobase} does allow these ``singleton nodes'' and has a method \code{hasSingle} for detecting them].
-Singleton nodes can be useful as a way of representing changes
-along a lineage; they are used this way in the \code{ouch} package.
-\item the number of occurrences of a node in the first column is related to the nature of the node: once if it is a singleton,
-twice if it is dichotomous (i.e., of degree 3 [counting
-ancestor as well as descendants]), three times if it is trichotomous (degree 4), and so on.
+\item all internal nodes [not including the root] must appear in the first (ancestor) column at least once [unlike \code{ape}, which nominally requires each internal node to have at least two descendants (although it doesn't absolutely prohibit them and has a \code{collapse.singles} function to get rid of them), \code{phylobase} does allow these ``singleton nodes'' and has a method \code{hasSingle} for detecting them]. Singleton nodes can be useful as a way of representing changes along a lineage; they are used this way in the \code{ouch} package.
+
+\item the number of occurrences of a node in the first column is related to the nature of the node: once if it is a singleton, twice if it is dichotomous (i.e., of degree 3 [counting ancestor as well as descendants]), three times if it is trichotomous (degree 4), and so on.
 \end{itemize}
 
-\code{phylobase} does not technically prohibit reticulations
-(nodes or tips that appear more than once in the descendant
-column), but they will probably break most of the methods.
-Disconnected trees, cycles, and other exotica are not tested for,
-but will certainly break the methods.
+\code{phylobase} does not technically prohibit reticulations (nodes or tips that appear more than once in the descendant column), but they will probably break most of the methods. Disconnected trees, cycles, and other exotica are not tested for, but will certainly break the methods.
 
 We have defined basic methods for \code{phylo4}:\code{show}, \code{print}, and a variety of accessor functions (see help files). \code{summary} does not seem to be terribly useful in the context of a ``raw'' tree, because there is not much to compute.
 
 \subsection{phylo4d}
 
-The \code{phylo4d} class extends \code{phylo4} with data.  Tip data, and (internal) node data are stored separately, but can be retrieved together or separately with \code{tdata(x,"tip")},
-\code{tdata(x,"internal")} or \code{tdata(x,"all")}.
-There is no separate slot for edge data, but these
-can be stored as node data associated with the
-descendant node.
+The \code{phylo4d} class extends \code{phylo4} with data. Tip data, and (internal) node data are stored separately, but can be retrieved together or separately with \code{tdata(x,"tip")}, \code{tdata(x,"internal")} or \code{tdata(x,"all")}. There is no separate slot for edge data, but these can be stored as node data associated with the descendant node.
 
 
 \subsection{multiphylo4}
@@ -497,7 +408,7 @@
 %There is a way to hack the \verb+$+ operator so that it would provide %backward compatibility with code that is extracting internal elements %of a \code{phylo4}. The basic recipe is:
 
 <<echo=FALSE,eval=FALSE>>=
-setMethod("$","phylo4",function(x,name) { attr(x,name)})
+setMethod("$", "phylo4", function(x, name) { attr(x, name)})
 @
 
 %but this has to be hacked slightly to intercept calls to elements %that might be missing.  For example, \code{ape} detects whether %log-likelihood, root edges, node labels, etc. are missing by testing %whether they are \code{NULL}, whereas missing items are represented %in \code{phylo4} by zero-length vectors in the slots (or \code{NA} %for the root edge) --- so we need code like
@@ -506,5 +417,4 @@
 @
 %to handle these cases.
 
-
 \end{document}

Modified: pkg/man/phylo4-class.Rd
===================================================================
--- pkg/man/phylo4-class.Rd	2009-04-21 23:44:13 UTC (rev 428)
+++ pkg/man/phylo4-class.Rd	2009-04-21 23:50:38 UTC (rev 429)
@@ -24,8 +24,7 @@
     \item{\code{tip.label}:}{character vector of tip labels}
     \item{\code{root.edge}:}{integer: root edge (NA if none)}
     \item{\code{order}:}{character: tree ordering (allowable values are
-      listed in \code{phylo4_orderings}, currently "unknown", "preorder"
-      (="pruningwise" in \code{ape}), "postorder" (="cladewise" in \code{ape}))}
+      listed in \code{phylo4_orderings}, currently "unknown", "preorder", "postorder" (="cladewise" in \code{ape})), ("pruningwise" and "cladewise" are allowed for compatibility with \code{ape} }
   }
   }
 \section{Methods}{



More information about the Phylobase-commits mailing list