percent stacked bar chart not scaling to 100%
It’s clear I’m not understanding the math behind what I wish to accomplish. I want a stacked bar chart showing the percent contribution of each contamination source to the total ASV counts per sample. My example data trytry
(dput()
below) contains simplified information including the sample name ($name
), ASV genus ($Genus
), the control the ASV originated from ($cont
), and the relative ASV abundance ($contmeanabund
) calculated using decostand(x, method="total")
on the original ASV count matrix. The column $perc2
was calculated with the code below, and $perc
are these values from the whole dataset.