[Phylobase-commits] r389 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 22 00:47:12 CET 2008
Author: bbolker
Date: 2008-12-22 00:47:12 +0100 (Mon, 22 Dec 2008)
New Revision: 389
Modified:
pkg/R/methods-phylo4.R
pkg/R/methods-phylo4d.R
pkg/R/phylo4.R
pkg/man/phylo4-class.Rd
pkg/man/phylo4d-class.Rd
Log:
added head and tail methods
Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R 2008-12-21 22:02:21 UTC (rev 388)
+++ pkg/R/methods-phylo4.R 2008-12-21 23:47:12 UTC (rev 389)
@@ -391,3 +391,13 @@
if(hasEdgeLength(x)) { x at edge.length <- x at edge.length[index] }
x
})
+
+setMethod("head",signature(x = 'phylo4'),
+ function(x,n=20) {
+ head(as(x,"data.frame"),n=n)
+ })
+
+setMethod("tail",signature(x = 'phylo4'),
+ function(x,n=20) {
+ tail(as(x,"data.frame"),n=n)
+ })
Modified: pkg/R/methods-phylo4d.R
===================================================================
--- pkg/R/methods-phylo4d.R 2008-12-21 22:02:21 UTC (rev 388)
+++ pkg/R/methods-phylo4d.R 2008-12-21 23:47:12 UTC (rev 389)
@@ -189,3 +189,13 @@
if(hasEdgeLength(x)) { x at edge.length <- x at edge.length[index] }
x
})
+
+setMethod("head",signature(x = 'phylo4d'),
+ function(x,n=20) {
+ head(as(x,"data.frame"),n=n)
+ })
+
+setMethod("tail",signature(x = 'phylo4d'),
+ function(x,n=20) {
+ tail(as(x,"data.frame"),n=n)
+ })
Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R 2008-12-21 22:02:21 UTC (rev 388)
+++ pkg/R/phylo4.R 2008-12-21 23:47:12 UTC (rev 389)
@@ -80,6 +80,10 @@
setGeneric("print")
+setGeneric("head")
+
+setGeneric("tail")
+
setGeneric("tdata", function(x, ...) {
standardGeneric("tdata")
})
Modified: pkg/man/phylo4-class.Rd
===================================================================
--- pkg/man/phylo4-class.Rd 2008-12-21 22:02:21 UTC (rev 388)
+++ pkg/man/phylo4-class.Rd 2008-12-21 23:47:12 UTC (rev 389)
@@ -8,6 +8,8 @@
\alias{[,phylo4,ANY,missing,missing-method}
\alias{print,phylo4-method}
\alias{show,phylo4-method}
+\alias{head,phylo4-method}
+\alias{tail,phylo4-method}
\alias{summary,phylo4-method}
\alias{names,phylo4-method}
\title{phylo4 and extended classes}
@@ -35,7 +37,9 @@
\item{show}{\code{signature(object = "phylo4")}: show method }
\item{summary}{\code{signature(object = "phylo4")}: summary method}
\item{names}{\code{signature(x = "phylo4")}: gives the slot names}
- }
+ \item{head}{\code{signature(object = "phylo4")}: show first few
+nodes}
+ \item{tail}{\code{signature(object = "phylo4")}: show last few nodes} }
}
\usage{
\S4method{print}{phylo4}(x,printlen,\dots)
Modified: pkg/man/phylo4d-class.Rd
===================================================================
--- pkg/man/phylo4d-class.Rd 2008-12-21 22:02:21 UTC (rev 388)
+++ pkg/man/phylo4d-class.Rd 2008-12-21 23:47:12 UTC (rev 389)
@@ -3,6 +3,8 @@
\alias{phylo4d-class}
\alias{show,phylo4d-method}
\alias{print,phylo4d-method}
+\alias{head,phylo4d-method}
+\alias{tail,phylo4d-method}
\alias{summary,phylo4d-method}
\alias{phylo4d,phylo4d-method}
\alias{names,phylo4d-method}
@@ -34,6 +36,9 @@
\item{show}{\code{signature(object = "phylo4d")}: show method }
\item{summary}{\code{signature(object = "phylo4d")}: summary method}
\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}
}
}
\usage{
More information about the Phylobase-commits
mailing list