mwpennell / geiger-v2

A suite of methods and models for studying evolutionary radiations
22 stars 17 forks source link

fitDiscrete fails when traits are, um, actually discrete? #16

Closed cboettig closed 8 years ago

cboettig commented 9 years ago

It looks like fitDiscrete takes numeric (doubles) but not integer-valued traits? From the example,

## match data and tree
tmp=get(data(geospiza))
td=treedata(tmp$phy, tmp$dat)
geo=list(phy=td$phy, dat=td$data)

And now let's use as.integer to make sure we're actually using discrete values instead of continuous values:

gb= as.integer(round(geo$dat[,5])) ## create discrete data
names(gb)=rownames(geo$dat)
tmp=fitDiscrete(geo$phy, gb, model="ER", control=list(niter=5), ncores=2)

I get this error:

.check.states(tree, states, strict.vals = 1:k) : 
  The states vector must contain names

Of course dropping the as.integer things work fine. Maybe I'm missing something here.

josephwb commented 8 years ago

@cboettig fixed with https://github.com/mwpennell/geiger-v2/pull/17 :neckbeard:

cboettig commented 8 years ago

nice, thanks!