Description Usage Arguments Details Examples
Sum up values assigned to tips of a tree down its nodes. It is used to get total fundings for each node, but can be used to sum up any tip value up to all nodes
1 | sum_tips(tree, values)
|
tree |
A phylo object |
values |
A numeric vector named with the tip labels of the tree. Names must match tip labels from tree. |
For now you must use tip labels to name the values vector. We can later just take values in the order of tips, in case users do not want to name their values vector.
1 2 3 4 5 6 7 8 9 10 11 12 | # generate a random tree:
library(ape)
t1 <- rcoal(10)
# generate some fake richness data
r1 <- c(rep(1,5), 400, 20, 30, 5, 200)
names(r1) <- t1$tip.label
# get the node richness values
x <- sum_tips(tree = t1, values = r1)
# plot them:
plot(t1, label.offset = 0.1)
tiplabels(x[1:Ntip(t1)], cex = 0.5)
nodelabels(x[-c(1:Ntip(t1))], cex = 0.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.