i recently started using Rstudios, because I need it for my research.
I want to show my data using Bar plots, but the bars won't sum. The data consists of catched flies (big or small) using different colored containers in different forests.
my code is the following:
ggplot(aes(x = Kleur, fill = as.character(Grote_vliegen))) +
geom_bar(alpha = 0.7) +
theme_bw(base_size = 12)+
labs(fill = "Kleur") +
But this plot does not consider that multiple flies can be caught within 1 sample (it won't sum). How can i write it that it will take the sum of all the flies (about 3000 in each color)? I think I have to change my dataset from a wide to a long conformation.
Here is a picture of the created plot:
Eventually I have to consider the different forests and want to implement this as a subcategorie in each barplot.
translated: (kleur=color / Grote_vliegen= Big_flies/ Kleine_vliegen=small_flies/ aantal=total)