# Create a random tree for the Day et al. 2016 data set:
day_2016tree <- ape::rtree(n = nrow(day_2016$matrix_1$matrix))
day_2016tree$tip.label <- rownames(x = day_2016$matrix_1$matrix)
day_2016tree$root.time <- max(diag(x = ape::vcv(phy = day_2016tree)))
# Build ten equal-length time bins spanning the tree:
time_bins <- matrix(data = c(seq(from = day_2016tree$root.time,
to = day_2016tree$root.time - max(diag(x = ape::vcv(phy = day_2016tree))),
length.out = 11)[1:10], seq(from = day_2016tree$root.time,
to = day_2016tree$root.time - max(diag(x = ape::vcv(phy = day_2016tree))),
length.out = 11)[2:11]), ncol = 2, dimnames = list(LETTERS[1:10], c("fad", "lad")))
# Set class as timeBins:
class(time_bins) <- "timeBins"
# Get proportional phylogenetic character completeness in ten equal-length
# time bins:
bin_character_completeness(
cladistic_matrix = day_2016,
time_tree = day_2016tree,
time_bins = time_bins
)
# Same, but with a plot:
bin_character_completeness(
cladistic_matrix = day_2016,
time_tree = day_2016tree,
time_bins = time_bins,
plot = TRUE
)
Run the code above in your browser using DataLab