[Phylobase-devl] tdata<- method bug

Steve Kembel skembel at berkeley.edu
Sun Jul 27 22:49:05 CEST 2008


Hi Peter,

The short answer is that the tdata<- method needs to be fleshed out.  
Currently there's no error checking at all and it assumes you're just  
assigning tip data, not tip + node data. There is a 'which' argument  
for the tdata<- method that lets you specify whether tip, node or  
alldata should be filled. Having said that, when I run tdata<- I get a  
different error message than you did, do you have the most recent  
version of phylobase installed?

 > library(phylobase)
Loading required package: ape
 > foo <- as(rcoal(5), 'phylo4d')
 > tdata(foo) <- as.data.frame(rnorm(9))
 > foo
Error in data.frame(label = data.names, tdata) :
   arguments imply differing number of rows: 5, 9
Error in print(as(x, "data.frame")) :
   error in evaluating the argument 'x' in selecting a method for  
function 'print'

I only get an error when I try to print the resulting object - it was  
assigning a 9-row data frame to the 5-row tip data slot.

I can put this on my to do list if no one else gets to it first, I had  
to tidy that method up recently but it's still somewhat broken.

Steve

On Jul 27, 2008, at 11:47 AM, Peter Cowan wrote:

> Hi all,
>
> I'm getting an error when I attempt the following.  I think this
> should be allowed no?  There appears to be a method defined but
> perhaps it's not being dispatched properly?
>
> Peter
>
> require(phylobase)
> Loading required package: phylobase
> Loading required package: ape
> foo <- as(rcoal(5), 'phylo4d')
> tdata(foo) <- as.data.frame(rnorm(9))
>
> Error in tdata(foo) <- as.data.frame(rnorm(9)) :
>  could not find function "tdata<-"
> _______________________________________________
> 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

______________________________________________
Dr. Steven Kembel - skembel at berkeley.edu
http://www.phylodiversity.net/skembel/




More information about the Phylobase-devl mailing list