title: Regression on subset of data set
body: <p>I'd like to do the following and need some help:</p>
  
  <p>Calculate slope and intercept for "Height" over "Age" [lm(Height~Age)] separately for </p>
  
  <p>(A) each individual </p>
  
  <p>(B) gender</p>
  
  <p>and create a table containing the results (slope and intercept).  Can I use "apply" for this?</p>
  
  <p>In a next step I would like to do a statistical test to determine if slope and intercept are significantly different between Gender. I know how to do the test in R but maybe there is a way to combine slope/intercept calculation and T-testing. </p>
  
  <p>Example data:</p>
  
  <pre><code>example = data.frame(Age = c(1, 3, 6, 9, 12,
                               1, 3, 6, 9, 12,
                               1, 3, 6, 9, 12,
                               1, 3, 6, 9, 12), 
                  Individual = c("Jack", "Jack", "Jack", "Jack", "Jack",
                                 "Jill", "Jill", "Jill", "Jill", "Jill",
                                 "Tony", "Tony", "Tony", "Tony", "Tony",
                                 "Jen", "Jen", "Jen", "Jen","Jen"),
                      Gender = c("M", "M", "M", "M", "M",
                                 "F", "F", "F", "F", "F",
                                 "M", "M", "M", "M", "M",
                                 "F", "F", "F", "F", "F"),
                      Height = c(38, 62, 92, 119, 165,
                                 31, 59, 87, 118, 170,
                                 45, 72, 93, 155, 171,
                                 33, 61, 92, 115, 168))
  </code></pre>