R/phylo2MRP.R

Defines functions phylo2MRP

Documented in phylo2MRP

phylo2MRP <- function(phy){
	splits <- prop.part(phy)
	cols <- length(attr(splits, "number"))
	rows <- length(attr(splits, "labels"))
	mat <- matrix(0, ncol = as.numeric(cols), nrow = as.numeric(rows), dimnames = list(attr(splits, "labels"), NULL))
	for(i in 1:cols) mat[splits[[i]], i] <- 1
	mat
}

Try the spiderDev package in your browser

Any scripts or data that you put into this service are public.

spiderDev documentation built on May 2, 2019, 5:23 p.m.