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

Aaron Mackey ajmackey at gmail.com
Wed May 21 17:41:58 CEST 2008


err, wait, sorry.  it's not nrows() we want, but max(edge) ...

-Aaron

On Wed, May 21, 2008 at 11:35 AM, Ben Bolker <bolker at zoology.ufl.edu> wrote:

>
>
>
> 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 --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20080521/58e19ef6/attachment.htm 


More information about the Phylobase-devl mailing list