wzmli / phyloglmm

GNU General Public License v3.0
4 stars 2 forks source link

Error from plylo_lmm - species identifier in data must be a factor #14

Open halabikeren opened 1 year ago

halabikeren commented 1 year ago

Hi,

Thank you for providing this important package to the community :)

I am trying to run the published example in the release with the most recent package version:

dir.create("data")
download.file("http://mpcm-evolution.com/OPM/Chapter11_OPM/data.zip",
dest="data/OPM_ch11_data.zip")
setwd("data")
untar("OPM_ch11_data.zip")
setwd("..")
}
phylo <- ape::read.nexus("data/phylo.nex")

phyloZ <- phylo.to.Z(phylo)

phylo_lmm_fit <- phylo_lmm(phen~cofactor+(1|sp)
, data=datG
, phylonm = "sp"
, phylo = phylo
, phyloZ=phyloZ
, REML = TRUE
, control=lmerControl(check.nobs.vs.nlev="ignore",check.nobs.vs.nRE="ignore")
)

And getting an error:

Error in get_phyloZ(phylo, phyloZ, data[[phylonm]]) : 
  species identifier in data must be a factor
In addition: Warning message:
In get_phyloZ(phylo, phyloZ, data[[phylonm]]) :
  both phylo and phyloZ provided: overwriting phyloZ

Could you please let me know what I am doing wrong? Many thanks!