## Requirement: 'webr'
# Info: Function designed to get a quick overview of the differences between the databases
visualize_database = function(data1, data2, data3, data4, data5, plot = NULL, print = T){
names_of_dataframes = c(deparse(substitute(data1)), deparse(substitute(data2)), deparse(substitute(data3)),
deparse(substitute(data4)), deparse(substitute(data5)))
number_sequences = c(nrow(data1), nrow(data2), nrow(data3), nrow(data4), nrow(data5))
number_species = c(length(unique(data1$SPECIES)), length(unique(data2$SPECIES)), length(unique(data3$SPECIES)),
length(unique(data4$SPECIES)), length(unique(data5$SPECIES)))
number_genus = c(length(unique(data1$GENUS)), length(unique(data2$GENUS)), length(unique(data3$GENUS)),
length(unique(data4$GENUS)), length(unique(data5$GENUS)))
number_families = c(length(unique(data1$FAMILY)), length(unique(data2$FAMILY)), length(unique(data3$FAMILY)),
length(unique(data4$FAMILY)), length(unique(data5$FAMILY)))
number_orders = c(length(unique(data1$ORDER)), length(unique(data2$ORDER)), length(unique(data3$ORDER)),
length(unique(data4$ORDER)), length(unique(data5$ORDER)))
table_numbers = tibble(data.frame(DATABASES = names_of_dataframes,
SEQUENCES = number_sequences, SPECIES = number_species, GENUS = number_genus,
FAMILIES = number_families, ORDERS = number_orders))
if(!is.null(plot)) {
if(plot == 1 || plot == 2 || plot == 3 || plot == 4) {
PieDonut(get(names_of_dataframes[plot], .GlobalEnv), aes(ORDER, FAMILY), explodePie = T, explodeDonut = F,
ratioByGroup = T, showPieName = T, showDonutName = T, pieLabelSize = 4, showRatioThreshold = 0.8,
labelpositionThreshold = 0.0001, labelposition = 1000, maxx = 1.3,
title = paste0(names_of_dataframes[plot], ": Families & Orders"))
}
}
if(print) print(table_numbers)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.