0

I'm trying to make a barplot with the mean values of income and expense (with these values shown above the bar) for males (1) and females (2) and different values of pol_group. So, income and expense should be represented on the y-axis, and there should be 2 clusters of bars (on the left males, with two bars, one for each value of pol_group; on the right females, with two bars, one for each value of pol_group). Here's a sample of my data...

pol_group       education   income     expense     sex
1               16          29258.71   29615        1
2               14          24062.49   26348.60     2
1               8           19281.74   23023        2
1               16          27224      26481        2
2               18          30102.65   29178.63     1
2               19          29873.44   27145        1
1               11          21435.11   24076.55     1 
1               17          28453.99   28312        2

How can I make this into a single bar graph with mean values displayed above the bars? How do I do this with just base R barplot (without ggplot2)?

B.Nin
  • 21
  • 1
  • Please include your data as an object pasted into the question with `dput(your_data)`; what code have you tried? This will make life easier for those who may want to help test and verify solutions. It’s really helpful if your question is reproducible. [How to ask a good question](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Peter Dec 04 '21 at 09:20

0 Answers0