The following function is adapted from HTSSIP R package Phyloseq conversion to a ggplot-formatted table
Useful links