# Getting the Taxus baccata forests data set
data(taxus_bin)
# Creating a group partition, as the one presented in the original article of
# the data set
groups <- rep(c(1, 2, 3), c(3, 11, 19))
# Removing taxa occurring in only one relevé, in order to reproduce exactly
# the example in the original article of the data set
taxus_bin_wmt <- taxus_bin[rowSums(taxus_bin) > 1, ]
# Calculating TDV using tdv()
tdv(taxus_bin_wmt, groups)$tdv
# Converting from the phytosociologic matrix format to the list format
taxus_phyto_list <- apply(taxus_bin_wmt, 1, function(x) which(as.logical(x)))
# Getting the number of relevés in the list
n_rel <- length(unique(unlist(taxus_phyto_list)))
# Calculating TDV using bigdata_tdv(), even if this is not a big matrix
bigdata_tdv(
phyto_list = taxus_phyto_list,
p = groups,
n_rel = n_rel,
output_type = "normal"
)$tdv
Run the code above in your browser using DataLab