title: Test if the slope in simple linear regression equals to a given constant in R
body: <p>I want to test if the slope in a simple linear regression is equal to a given constant other than zero. </p>
  
  <pre><code>&gt; x &lt;- c(1,2,3,4)
  &gt; y &lt;- c(2,5,8,13)
  &gt; fit &lt;- lm(y ~ x)
  &gt; summary(fit)
  
  Call:
  lm(formula = y ~ x)
  
  Residuals:
     1    2    3    4 
   0.4 -0.2 -0.8  0.6 
  
  Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)   
  (Intercept)  -2.0000     0.9487  -2.108  0.16955   
  x             3.6000     0.3464  10.392  0.00913 **
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  
  Residual standard error: 0.7746 on 2 degrees of freedom
  Multiple R-squared:  0.9818,    Adjusted R-squared:  0.9727 
  F-statistic:   108 on 1 and 2 DF,  p-value: 0.009133
  &gt; confint(fit)
                  2.5 %   97.5 %
  (Intercept) -6.081855 2.081855
  x            2.109517 5.090483
  </code></pre>
  
  <p>In this example, I want to test if the slope is equal to 5. I know I won't reject it since 5 is in the 95% CI. But is there a function which can give me the p-value directly?</p>