UPDATE – July 2017
The site I was originally using to store the script and data has since closed, have migrated to GitHub, and updated the R code to remove deprecated ggplot code etc.
Apologies that the output isn’t showing well as far as spacing and alignment is concerned. Am working on fixing that!
Generally when we have a set of data, we have known groupings. Be that three different treatment groups, two sex groups, 4 ethnicity groups etc. There is also the possibility of unobserved groupings within your data, some examples (I’m clutching at straws here) are those who are vegetarians and those who aren’t, those who regularly exercise and those who don’t, or those who have a family history of a certain condition and those who don’t (assuming those data were not collected). There is an approach to look into this.