[Phylobase-devl] phylo4: tabulate() requires nbins argument

Ben Bolker bolker at zoology.ufl.edu
Wed May 21 17:35:40 CEST 2008




Aaron Mackey wrote:
> I don't have functional SVN access at the moment, otherwise I'd do this
> myself.  But essentially, calls to "tabulate()" need to define the number of
> bins explicitly, otherwise problems occur.  For example:
> 
>> edge
> [1,]  1  3
> [2,]  1  2
> [3,]  3  4
> [4,]  3  7
> [5,]  4  5
> [6,]  4  6
> [7,]  7  8
> [8,]  7  9
>> tabulate(edge[,1])
> [1] 2 0 2 2 0 0 2
>> tabulate(edge[,1], nbins=dim(edge)[1])
> [1] 2 0 2 2 0 0 2 0
> 
> -Aaron
> 

   I grepped for "tabulate".  Are you recommending that
we change all of these usages as above?
(Is it worth defining a "tabedge" function

tabedge <- function(object,i) {
     tabulate(edges(object[,i]), nbins=nrow(edges(object)))
}

   to replace most of these, or is that just too complicated?

   Ben


1 checkdata.R:    nAncest <- tabulate(edges(object)[, 2])
2 class-phylo4.R:    ntips <- sum(tabulate(edge[, 1]) == 0)
3 class-phylo4.R:    nnodes <- sum(tabulate(edge[, 1]) > 0)
4 methods-phylo4.R:    tabulate(edges(x)[, 1])[nTips(x) + 1] <= 2
5 methods-phylo4.R:        temp <- tabulate(E[,1])
6 treestruc.R:  degree <- tabulate(edges(object)[, 1])
7 treestruc.R:  degree <- tabulate(edges(object)[, 1])
8 treestruc.R:#  isTips <- (tabulate(x at edge[,1]) == 0)
9 treestruc.R:#  res <- (tabulate(x at edge[,1]) > 2)




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20080521/2ab0db3c/attachment-0001.pgp 


More information about the Phylobase-devl mailing list