title: Extract Regression P Value in R
body: <p>I am performing multiple regressions on different columns in a query file. I've been tasked with extracting certain results from the regression function lm in R.</p>
  
  <p>So far I have,</p>
  
  <pre><code>&gt; reg &lt;- lm(query$y1 ~ query$x1 + query$x2)
  &gt; summary(reg)
  
  Call:
  lm(formula = query$y1 ~ query$x1 + query$x2)
  
  Residuals:
      1     2     3     4 
    7.68 -4.48 -7.04  3.84 
  
  Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)
  (Intercept)  1287.26     685.75   1.877    0.312
  query$x1      -29.30      20.92  -1.400    0.395
  query$x2     -116.90      45.79  -2.553    0.238
  
  Residual standard error: 11.97 on 1 degrees of freedom
  Multiple R-squared:  0.9233,    Adjusted R-squared:  0.7699 
  F-statistic: 6.019 on 2 and 1 DF,  p-value: 0.277
  </code></pre>
  
  <p>To extract the coefficients, r-squared and F statistics I use the following:</p>
  
  <pre><code>reg$coefficients
  summary(reg)$r.squared
  summary(reg)$fstatistic
  </code></pre>
  
  <p>I would like to also extract the p-value of 0.277.</p>
  
  <p>Is there a piece of code that could do this?</p>
  
  <p>Thanks</p>