title: R shiny error: Problems with a reactive function
body: <p>I am making an interactive graph in R studio with the new shiny markdown. What the idea is to create an active page where you have two input fields to determine the size of a, the size of b and what is left is the size of c. The input is in percentage. The output is a graph with a line and bars, which works. However, I have two problems.</p>
  
  <ol>
  <li>The second input has to be dependent of the first input, because you can never have more than 100 percent.</li>
  <li>The size of a and b is determined after the input is given. If the input changes, a, b and c has to be determined again.</li>
  </ol>
  
  <p>I am quite new to R and searched to other questions but could not solve my problems. This is my code and how I tried to solve it:</p>
  
  <pre><code>inputPanel(
    numericInput("aa", label = "a:",
                min = 1 , max =100 , value = 80 , step = 1),
  
    numericInput("bb", label = "b:",
                min = 1 , max = 100-input$aa , value = 15 , step = 1)
  )
  </code></pre>
  
  <p>This is my first problem. I want to be the second numeric input to be reactive on the first input. I tried the following options for this problem:</p>
  
  <pre><code>  numericInput("bb", label = "b:",
                min = 1 , max = observe(100-input$aa,suspended= TRUE) , value = 15 , step = 1)
  </code></pre>
  
  <p>This did not work. The next thing I tried is:</p>
  
  <pre><code>  numericInput("bb", label = "b:",
                min = 1 , reactive({max = 100-input$aa}) , value = 15 , step = 1)
  </code></pre>
  
  <p>This as well gave an error. After trying this options, I find it quite logic it does not work, however, still can not find it how to solve this.</p>
  
  <p>The second problem is in the next code. </p>
  
  <pre><code>###change the column b
   for(i in nrow(df)){reactive({
    if(input$aa&gt;df$a[i]){
    df$b[i] = "a"
  } else {if(input$aa+input$bb&gt;df$a[i]){
    df$b[i] = "b"
  }else {df$b[i] = "c"}}})}
  </code></pre>
  
  <p>I want to change the value of the column b in df. This piece of code does not give any errors, however, it is not active, it does not change the column b. I tried the following:</p>
  
  <pre><code>###Change the column b
  shinyServer(function(input, output) {
  for(i in nrow(df)){reactive({
    if(input$large&gt;df$a[i]){
    df$b[i] = "a"
  } else {if(input$aa+input$bb&gt;df$a[i]){
    df$b[i] = "b"
  }else {df$b[i] = "c"}}})}})
  </code></pre>
  
  <p>This seems to ignore the code even more. This is what I tried and I am quite new to R. I hope someone can help me with this issue. </p>
  
  <p>Thanks in advance,
  <strong>EDIT After comment</strong></p>
  
  <p>Shortest program (in my opinion)</p>
  
  <pre><code>---
  title: "a"
  author: "b"
  date: "6/24/2014"
  output: html_document
  runtime: shiny
  ---
  
  ```{r, echo=FALSE}
  
  library(ggplot2)
  library(shiny)
  df= data.frame(a=c(1:20),b=c(1:20))
  
  df$c=1 #just to make sure column c exist.
  inputPanel(
    numericInput("aa", label="a", min = 1, max = 100, value =50)
                ,
  
    numericInput("bb",label= "b", min = 1, max = 100-input$aa, value = 10)
  )
  
    df$c &lt;- reactive({
    df$c &lt;- input$aa
  })
  
  renderPlot({
    ggplot(df) +
    geom_line(aes(a, b, colour= c ))
  })
  ```
  </code></pre>
  
  <p>Eddy</p>