title: Need the Slope and Intercept from Linear Regression using Tableau and R
body: <p>I have a Dataset in Tableau, from which i need to get the Slope and Intercept of the Linear Regression best fit line using the lm() function in R.</p>
  
  <p>The regression is a basic one, with just one predictor variable and one dependent. How do I handle the fact that i need to pass an aggregated value to the lm() function, even though i need to send the entire column?</p>
  
  <p>With a column called 'Predictor', and another called 'Dependent', I essentially need to do this in Tableau:</p>
  
  <pre><code>fit &lt;- lm(df$Dependent ~ df$Predictor)
  return fit
  </code></pre>
  
  <p>Tableau does not let me do this unless I pass to it</p>
  
  <pre><code>SUM[Dependent] and SUM[Predictor]
  </code></pre>
  
  <p>But instead of aggregating it, i need it to work on the entire column</p>
  
  <p>Thanks</p>