title: ggplot line graph with NA values
body: <p>I'm having with trouble with ggplot trying to plot 2 incomplete time series on the same graph where the y data does not have the same values on the x-axis (year) - NAs are thus present for certain years :</p>
  <pre><code>test&lt;-structure(list(YEAR = c(1937, 1938, 1942, 1943, 1947, 1948, 1952, 
  1953, 1957, 1958, 1962, 1963, 1967, 1968, 1972, 1973, 1977, 1978, 
  1982, 1983, 1986.5, 1987, 1993.5), A1 = c(NA, 24, NA, 32, 32, 
  NA, 34, NA, NA, 18, 12, NA, 10, NA, 11, NA, 15, NA, 24, NA, NA, 
  25, 26), A2 = c(40, NA, 38, NA, 25, NA, 26, NA, 20, NA, 17, 
  17, 17, NA, 16, 18, 21, 18, 17, 25, NA, NA, 26)), .Names = c(&quot;YEAR&quot;, &quot;A1&quot;, 
  &quot;A2&quot;), row.names = c(NA, -23L), class = &quot;data.frame&quot;)
  </code></pre>
  <p>The following code I tried outputs a disjointed mess :</p>
  <pre><code>ggplot(test, aes(x=YEAR)) + 
    geom_line(aes(y = A1), size=0.43, colour=&quot;red&quot;) +  
    geom_line(aes(y = A2), size=0.43, colour=&quot;green&quot;) +
    xlab(&quot;Year&quot;) + ylab(&quot;Percent&quot;) +
    scale_x_continuous(limits=c(1935, 1995), breaks = seq(1935, 1995, 5),
                       expand = c(0, 0)) + 
    scale_y_continuous(limits=c(0,50), breaks=seq(0, 50, 10), expand = c(0, 0))
  </code></pre>
  <p><img src="https://i.stack.imgur.com/PtinL.png" alt="enter image description here" /></p>
  <p>How can I solve this problem?</p>