title: Summing multiple columns in Spark
body: <p>How can I sum multiple columns in Spark? For example, in SparkR the following code works to get the sum of one column, but if I try to get the sum of both columns in <code>df</code>, I get an error. </p>
  
  <pre><code># Create SparkDataFrame
  df &lt;- createDataFrame(faithful)
  
  # Use agg to sum total waiting times
  head(agg(df, totalWaiting = sum(df$waiting)))
  ##This works
  
  # Use agg to sum total of waiting and eruptions
  head(agg(df, total = sum(df$waiting, df$eruptions)))
  ##This doesn't work
  </code></pre>
  
  <p>Either SparkR or PySpark code will work.</p>