[Phylobase-devl] check_phylo4() bug

Ben Bolker bolker at zoo.ufl.edu
Wed Feb 27 16:45:32 CET 2008

   Two thoughts:

   (1) for your first example -- we shouldn't have to be responsible
for people who muck with the internals of phylobase objects.  If
it couldn't be constructed with phylobase functions (i.e. the
constructor or coercion or the phylo4() command) and doesn't
pass check_phylo4, then you're on your own.  Nevertheless, since
we had the checks in there anyway I've fixed them so they
actually do something.

   (2) is more serious -- the situation here seems to
be that foo has tip labels but no (internal) node labels.
as(foo,"data.frame") gets confused, as does plot.
I think at the moment we're assuming that internal
node labels exist (even if blank).

   I can make printing work as follows;

foo <- new('phylo4')
foo at edge <- rcoal(10)$edge
foo at tip.label <- rep('blah',10)
foo at node.label <- rep("",9)

   but I still crash the plot function.

   should we

(a) insist that internal node labels exist?
(b) modify the coercion to data frame to work
    without node labels?

   I'm not yet sure of the problem with plot.

   I would also like it if (eventually) plot worked
with 'singleton' nodes, but that could be a lot
of work ...


Peter Cowan wrote:
> A first for me, I found a way to dump core on R.
> I was trying to put a phylo4 object together by hand.  Granted this is  
> pretty stupid use, but perhaps we should validate before plotting.
> require(phylobase)
> foo <- new('phylo4')
> foo at edge <- rcoal(10)$edge
> plot(foo) ## WARNING core dumps on my system
> foo doesn't pass check_phylo4()
> however if I do:
>  > foo at tip.label <- rep('blah', 10)
>  > check_phylo4(foo)
> [1] TRUE
>  > foo
> Error in data.frame(species.name, node, ancestor, branch.length,  
> node.type) :
>    arguments imply differing number of rows: 10, 19
> Error in print(as(x, "data.frame")) :
>    error in evaluating the argument 'x' in selecting a method for  
> function 'print'
> and plot(foo) hangs.
> Peter
> _______________________________________________
> Phylobase-devl mailing list
> Phylobase-devl at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/phylobase-devl

-------------- 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/20080227/95830d66/attachment.pgp 

More information about the Phylobase-devl mailing list