title: ggplot for different year categories
body: <p>I am really struggling with the plots in R. I have to make a plot of logmx versus the age of males in different years in the same plot for males. In this plot there must be 4 lines for "1870-1879", "1940-1949", "1960-1969", "1980-1989"
  I made 4 differents subsets with these specific years and tried to combine them but I am new in R and I do not know what I am doing wrong. I saw lots of similar answers but I could not solve it.I need to make it with ggplot2 package.</p>
  
  <p><code>males11&lt;-males[445:1555,1:3]</code><br>
  <code>males12&lt;-males[4885:5995, 1:3]</code><br>
  <code>males13&lt;-males[9325:10435, 1:3]</code><br>
  <code>males14&lt;-males[13765:14653, 1:3]</code>     #for the subsets</p>
  
  <p><code>d1 &lt;- data.frame(males11$Age, log(males11$mx), males11$Year)</code><br>
  <code>d2 &lt;- data.frame(males12$Age, log(males12$mx), males12$Year)</code><br>
  <code>d3 &lt;- data.frame(males13$Age, log(males13$mx), males13$Year)</code><br>
  <code>d4 &lt;- data.frame(males14$Age, log(males14$mx), males14$Year)</code>    </p>
  
  <p><code>ggplot()</code><br>
   + 
    <code>geom_line(aes(males11$Age, log(males11$mx), colour=males11$Year),  d1)</code> +<br>
    <code>geom_line(aes(males12$Age, log(males12$mx), colour=males12$Year), d2)</code> +<br>
    <code>geom_line(aes(males13$Age, log(males13$mx), colour=males13$Year), d3)</code> +<br>
    <code>geom_line(aes(males14$Age, log(males14$mx), colour=males14$Year), d4)</code>    </p>