title: interactive slider in .Rmd file for Regression
body: <p>I try to code my first interactive .Rmd file:</p>
  
  <p>I just want to show the interaction in a linear regression x~y by </p>
  
  <pre><code> y(x)= a*x + b
  </code></pre>
  
  <p>I just want to take two sliders:</p>
  
  <p>one for b and one for a </p>
  
  <p>my code is until now:</p>
  
  <pre><code>--- 
  output: html_document
  runtime: shiny
  ---
  
  ## some text...
  
  *some more text
  
  &lt;br&gt;&lt;br&gt;
  
  ```{r setup, include=FALSE}
  knitr::opts_chunk$set(echo = TRUE)
  ```
  
  
  ```{r, echo = FALSE, message=FALSE, warnings=FALSE}
  
  mietspiegel &lt;- read.table("http://www.stat.uni-muenchen.de/service/datenarchiv/miete/miete03.asc", header=TRUE)
  mieten_regression &lt;- lm(mietspiegel$nm ~ mietspiegel$wfl)
  mieten_regression$coefficients
  
  b &lt;- mieten_regression$coefficients[1]      # Coefficient No. 1   Intercept
  a &lt;- mieten_regression$coefficients[2]      # Coefficient No. 2   mietspiegel$wfl
  
  # Slider ...
  inputPanel(sliderInput("b", "Coefficient No. 1 Intercept", min = 0, max = 2000, step = 1, value = b), 
  sliderInput("a", "Coefficient No. 2 Wohnflaeche", min = 0, max = 200, step = 10, value = a),
  actionButton("sample", "Resample"))
  
  # Scatterplott
  library(ggplot2)
  ggplot(mietspiegel, 
  aes(y=nm, x=wfl)) +
  geom_abline(intercept = b, slope = a, colour = "red") + # Add inear regression line     
  geom_point(shape=1) + # Use hollow circles
  xlab("Fläche") +
  ylab("Price")
  
  ```
  </code></pre>
  
  <p>I don't know how to use the slider input correctly. I want for my linear regression line a slider for a and a slider for b so that you can input there your coefficents intercept (b) and  mietspiegel$wfl (a) are and see the new regression line after this.</p>