title: calculate row sum and product in data.frame
body: <p>I would like to append a columns to my data.frame in R that contain row sums and products 
  Consider following data frame</p>
  
  <pre><code>x    y     z
  1    2     3
  2    3     4
  5    1     2
  </code></pre>
  
  <p>I want to get the following</p>
  
  <pre><code>x    y     z    sum    prod
  1    2     3    6       6  
  2    3     4    9       24 
  5    1     2    8       10
  </code></pre>
  
  <p>I have tried </p>
  
  <pre><code> sum = apply(ages,1,add)
  </code></pre>
  
  <p>but it gives me a row vector. Can some one please show me an efficient command to sum and product and append them to original data frame as shown above?</p>