title: How can I add the populations of males and females together to remove gender as a variable in a demographics table. In R Studio
body: <p>This is my first time posting a question, so may not have the correct info to start, apologies in advance. Am new to R. Prefer to use dplyr or tidyverse because those are the packages we've used so far. I did search for a similar question, but most gender/sex related questions are around separating the data, or performing operations on each separately.</p>
  <p>I have a table of population counts, with variables (factors) Age Range, Year and Sex, with Population as the dependent variable. I want to create a plot to show if the population is aging - that is, showing how the relative proportion of different ages groups changes over time. But gender is not relevant, so I want <strong>to add together the population counts for males and females, for each year and age range.</strong></p>
  <p>I don't know how to provide a copy of the raw data .csv file, so if you have any suggestions, please let me know.</p>
  <p>This is a sample of the data(output table):
  <a href="https://i.stack.imgur.com/0HI3l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0HI3l.png" alt="output table" /></a></p>
  <p>And here is the code so far:</p>
  <pre><code> file_name &lt;- &quot;AusPopDemographics.csv&quot;
  AusDemo_df = read.table(file_name,&quot;,&quot;, header=TRUE)
  
  (grp_AusDemo_df &lt;- AusDemo_df %&gt;% group_by(Year, Age))
  </code></pre>
  <p>I am guessing it may be something like pivot(wider) to bring male and female up as column headings, then transmute() to sum them and create a new population column.</p>
  <p>Thanks for your help.</p>