title: Creating a scatter diagram with least square regression line according to Type
body: <p>I have data that is set up like the following:</p>
  
  <pre><code>type     age     rust
  0        1       29.00
  0        0       95.00
  .....
  
  1        1800    7.56
  </code></pre>
  
  <p>I would like to create a scatter diagram of rust vs. age according to Type 0 and 1. I also would like to overlay a least square regression line in red for type 0 and blue for type 1. </p>
  
  <p>I tried the following but when I tried overlaying the abline command it was way off the graph:</p>
  
  <pre><code>library(lattice)
  
  xyplot(rust$rust~rust$age, group = rust$type, main = "Scatterplot of Rust vs. Age by Type")
  abline(rust$rust~rust$age, col = "blue")
  </code></pre>