I am new to R. I would like others to explain to me how to add absolute values inside the individual stacked bars in a consistent way using the basic R plotting function (R base). I tried to plot a stacked bar graph using R base but the values appear in an inconsistent/illogical way in such a way that its supposed to be 100% for each village but they don't sum up to 100%. Here is the data that am working on:
Village 100 200 300 400 500
Male 68.33333 53.33333 70 70 61.66667
Female 31.66667 46.66667 30 30 38.33333
In summary, there are five villages and the data showing the head of household interviewed by sex.
I have used the following command towards plotting the graph:
barplot(mydata,col=c("yellow","green")
x<-barplot(mydata,col=c("yellow","green")
text(x,mydata,labels=mydata,pos=3,offset=.5)
Please help to allocate the correct values in each bar Thanks