[Phylobase-devl] minor update

François Michonneau francois.michonneau at gmail.com
Mon Sep 29 23:28:15 CEST 2008


On Tue, 2008-09-23 at 12:05 -0700, Steven Kembel wrote:
> The solution must be to write a method for assignment to a single  
> column or subset of the tdata data.frame object, but I'm not sure
> how  
> to do this. Currently the <- assignment method for tdata would not
> be  
> called for tdata(obj)$foo <- bar, which is why the names are not
> being  
> matched properly (check_data never gets called). Any S4 wizards on
> the  
> list want to speculate how to do this?
> 
> i.e. we want a method something like the existing
> setMethod("tdata<-", "phylo4d", function(object, which = c("tip",
>      "node", "allnode"), ..., value) {...}
> but which would work for tdata subsets created using tdata$foo or  
> tdata[,foo]

I have started to look into that this afternoon but it seems that there
is no easy answer. From what I read it doesn't seem possible to do
something like that unless we introduce a new class for data associated
with trees (i.e. to objects returned by the function tdata). I'll try to
look more into that next week. If anybody has suggestions for this, let
me know.

While I was reading about this issue, I found that it's not the
"correct" way to set replacement methods as:
setMethod("tdata<-", ...)
but it should be:
setReplaceMethod("tdata", ...)

Note however that setGeneric("tdata<-") seems correct.

I changed this syntax for the different methods. If however, there was a
good reason to use setMethod("tdata<-", ...) let me know and I'll revert
to the previous version.

Cheers,

   François



More information about the Phylobase-devl mailing list