[Phylobase-devl] Testing framework

François Michonneau francois.michonneau at gmail.com
Fri Aug 14 13:35:27 CEST 2009


> 3,4. Two sets of test failures were both caused by a change to getNode 
> in the case where the node argument is an integer (node ID). In trunk, 
> the function *always* returns a vector of the numeric IDs, with the 
> labels as element names. Of course, an element and/or its name may be NA 
> depending on whether the requested node exists in the tree and has a 
> label. In fm-branch, the returned element name is sometimes the label, 
> and other times the ID (even differing within the same returned vector). 
> This strikes me as a programming landmine, and I strongly favor the 
> trunk behavior. As an example, notice how seemingly contradictory 
> results are possible in the (perfectly valid) case where node labels are 
> themselves number-like:
> 
> data(geospiza)
> nodeLabels(geospiza) <- as.character(101:113)
> 
> # in fm-branch
> getNode(geospiza, c(1, 15, 101), missing="OK")
> ## fuliginosa        101        101
> ##          1         15         NA
> 
> # in trunk
> getNode(geospiza, c(1, 15, 101), missing="OK")
> ## fuliginosa        101       <NA>
> ##          1         15         NA
> 
> I admit the <NA> name isn't pretty, but IMHO it gives less room for 
> misinterpretation and surprising downstream behavior.

  My last commit should fix this problem.

  I found another problem though related with the issue of having
number-like labels. Indeed, when I was first starting to hack on this
branch I had a test to prevent labels from being number-like but this
was a little too restrictive. However, there is still small piece of
code that remains from this time.

  Currently when you supply data with numbers as row names and use the
option match.data with the phylo4d constructor then it's assumed that
the numbers represent node numbers. However, if the tree has number-like
labels then the user will be disappointed to see her/his data matched
with the nodes instead of the tree's labels.

  To deal with this, I propose to add a boolean option like
rownamesAsLabels in the phylo4d constructor.

1. Do you think it's a good idea? If not, what alternative solution
would you recommend?

2. What should be the default? I think it should be FALSE because by
default data.frame objects have numbered row names and by default
phylo4(d) objects don't have number-like labels.

  Cheers,
  -- François




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20090814/d05c7dbf/attachment.pgp 


More information about the Phylobase-devl mailing list