# Load simulated dataset and tree
data(data1)
data(sim.tree1)
# Perform node averaging
unwtd <- node.averager(dataset = data1, tree = sim.tree1, varb = "pred",
taxacolumns = c("sp1", "sp2"))
wtd <- node.averager(dataset = data1, tree = sim.tree1, varb = "pred",
taxacolumns = c("sp1", "sp2"), weighted = TRUE)
# Compare outcomes of weighted and unweighted node averaging
unwtd
wtd
summary(unwtd)
summary(wtd)
# Calculate data loss
nrow(data1) - length(wtd)
nrow(data1) - length(unwtd)
# \donttest{
# Plot tree and node labels
library(ape)
plot(sim.tree1)
nodelabels()
# }
Run the code above in your browser using DataLab