title: Applying a function for calculating AUC for each subject
body: <p>I want to calculate the area under the curve(AUC) of concentration-TIME profiles for many subjects (~200 subjects). I am using the package MESS where:</p>
  
  <pre><code>AUC = auc(data$TIME,data$CONC, type = "spline")
  </code></pre>
  
  <p>How can I apply it to each unique ID in the data set? and retain the results in R by adding a new "AUC" column in the original data set?</p>
  
  <p>The data has the following columns:</p>
  
  <pre><code>ID TIME CONC 
  1   0    0
  1   2    4
  1   3    7
  2   0    0
  2   1    NA
  2   3    5
  2   4    10
  </code></pre>