[Phylobase-devl] extractTree proposal
Ben Bolker
bolker at ufl.edu
Tue Aug 25 18:49:08 CEST 2009
this sounds sensible. the only concern I have (and perhaps the reason
we originally set things up in what has now come to be a slightly
bass-ackwards way) is that we have a warning message issued on coercion
from phylo4d to phylo4 ("data lost"), which we don't with the explicit
extractTree function (because there we assume that's what the user
really wants to do). Is there a way to achieve this behavior with
your approach? (I guess we could use suppressWarnings(as(...)) but
that would suppress *all* warnings?)
Jim Regetz wrote:
> Hi all,
>
> The extractTree function currently extracts the tree part of a phylo4d
> object by manually accessing each relevant phylo4 slot and passing them
> to the phylo4('matrix') constructor. I'd like to propose this instead:
>
> extractTree <- function(from) as(from, "phylo4")
>
> Note that this "as" method requires no maintenance on our part, because
> it is derived implicitly from the class definition of phylo4d as an
> extension of phylo4. You can use this incantation to see the method:
> selectMethod("coerce", c("phylo4d", "phylo4"))
>
> Defining extractTree this way makes it faster and simpler, and also more
> robust to other code changes. It also means that if there are problems
> with the phylo4d object, an error will come from checkTree rather than
> the phylo4 constructor, which IMHO is more sensible. If future changes
> require a more complicated approach, we can deal with it then (and it
> will still just be extractTree to the end user, which is a good reason
> not to drop this function altogether).
>
> Thanks,
> Jim
> _______________________________________________
> 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
--
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20090825/817a6f34/attachment.pgp
More information about the Phylobase-devl
mailing list