/packages/archive/2010/04.2010/04.20.2010/spacodi/R/K.exp.nodes.R

http://github.com/eastman/spacodiR · R · 17 lines · 16 code · 1 blank · 0 comment · 3 complexity · fac8a0bb984b2626b0fe822939044af9 MD5 · raw file

  1. K.exp.nodes <-
  2. function(phy, n.rep = 10, brownian = TRUE,...) {
  3. require(geiger)
  4. out <- matrix(ncol = n.rep, nrow = Nnode(phy))
  5. trt <- matrix(ncol = n.rep, nrow = length(phy$tip.label))
  6. if(brownian == TRUE){
  7. trt.sims <- as.data.frame(sim.char(phy = phy, as.matrix(1), n.rep))
  8. names(trt.sims)=paste("trt",seq(1:n.rep),sep=".")
  9. } else {
  10. trt.sims <- as.data.frame(replicate(n.rep, runif(Ntip(phy))))
  11. row.names(trt.sims)=phy$tip.label
  12. names(trt.sims)=paste("trt",seq(1:n.rep),sep=".")
  13. }
  14. out <- K.all.nodes(phy = phy, traits = trt.sims,...)
  15. return(out)
  16. }