I have managed to produce error bars from SD for my barplots when using only one variable, but once I try to include error bars for a data set with two variables, using position="dodge" and fill="variable", the error bars do not work.
I have included the ggplot code I have been using below as well as an image of the graph and some of the raw data in my table. Is there a way I can separate the error bars to be specific to either the Iron or no iron columns?
Thank you, that moved them into the right positions horizontally. I now have the issue of them not being correctly positioned vertically, with some of them not being anywhere near the plotted value. In the code I've got it should be instructing the error bars to be placed 1 SD above the mean and 1 SD below the mean, but as you can see, some of them are just positioned in the middle of the bar. It seems they are all based upon the same mean value, so how would I adjust this so each error bar is specific to each bar?
I'm not convinced you need stat_summary, if you follow the link here, you will a number of examples or barplots with error bar that may give you a better idea of how to code the graph. This link is perhaps closer to your example.
When I didn't use stat_summary before it caused the bars to look like they do in the picture below, as it was plotting all of the raw data for each variable on top of each other, so I used stat_summary in order to only plot the mean data values. Would there not be a way, whilst using stat_summary, to have the error bars coming from a different value for each bar?