title: R Shiny nested uiOutput error: input => uiOutput => uiOutput => output
body: <p>I have a problem for design a nested input/output app. (I have also tried to post this question to <a href="https://groups.google.com/forum/#!forum/shiny-discuss" rel="nofollow">shiny-discuss</a>. However, it would be automatically deleted when I post. Why?) </p>
  
  <p>My app can be simplified as the following steps:</p>
  
  <ol>
  <li><p>Input dataset by textarea. i.e.: input$textarea.in</p></li>
  <li><p>Load dataset and show the name list of the imported dataset. User could select data by selectInput.  i.e: uiOutput("choosedata")</p></li>
  <li><p>Compute the range of selected data and then display a sliderInput. i.e.: uiOutput("range")</p></li>
  <li><p>Finally, compute the square of value selected by sliderInput. i.e.:verbatimTextOutput("range.out")</p></li>
  </ol>
  
  <p>That is:</p>
  
  <pre><code>input =&gt; uiOutput =&gt; uiOutput =&gt; output
            (work!)     (work!)    (error!)
  </code></pre>
  
  <p>The error will happen at step 4 after changing imported dataset.
  To be more specific, the initial input format is:</p>
  
  <pre><code>Data.A 1 2 3 4 5
  Data.B 6 7 8 9 10 11
  </code></pre>
  
  <p>Another input format is:</p>
  
  <pre><code>Data.C 1 3 5 7
  Data.D 2 4 6 8
  </code></pre>
  
  <p>Steps 2 and 3 would automatically change, but step 4 wont.
  How to fix it?</p>
  
  <p>Best</p>
  
  <p>Note that the online app and code are following:</p>
  
  <p><a href="http://glimmer.rstudio.com/tchsieh/myapp/" rel="nofollow">http://glimmer.rstudio.com/tchsieh/myapp/</a></p>
  
  <pre><code>#=========================
  #ui.R
  #=========================
  library(shiny)
  shinyUI(pageWithSidebar(  
    headerPanel("Title"),
    sidebarPanel(
      p("Text Area:"),
      tags$textarea(id="textarea.in", rows=3, "Data.A 1 2 3 4 5 \nData.B 6 7 8 9 10 11"),
      uiOutput("choosedata"),
      uiOutput("range")
    ),
  
    mainPanel(    
      h2("Test"),
  
      h3("Raw Data (step1: work!)"),
      verbatimTextOutput("textarea.out"),
  
      h3("Range of the selected data (step2: work!)"),
      verbatimTextOutput("summary"),
  
      h3("Squared of the selected value (step3:error when change Text area)"),
      verbatimTextOutput("range.out")
  
  
    )
  ))
  
  #=========================
  #server.R
  #=========================
  library(shiny)
  shinyServer(function(input, output) {
    loadPaste &lt;- reactive({
      text &lt;- input$textarea.in
      temp &lt;- lapply(readLines(textConnection(text)), function(x) scan(text = x, what='char'))
      out &lt;- list()
      out.name &lt;- 0
      for(i in seq_along(temp)){
        out.name[i] &lt;- temp[[i]][1]
        out[[i]] &lt;- as.numeric(temp[[i]][-1])
      }
      names(out) &lt;- t(data.frame(out.name))
      out
    })
  
    output$textarea.out &lt;- renderPrint({
      loadPaste()
    })
  
    output$choosedata &lt;- renderUI({
      dataname &lt;- names(loadPaste())  
      dataList &lt;- list()
      for(i in seq_along(dataname)){
        dataList[[i]] &lt;- dataname[i]
      }
      selectInput("dataset", "Select dataset:", choices  = dataList, selected = dataList[1])
    })
  
    output$summary &lt;- renderPrint({
      out &lt;- loadPaste()
      id &lt;- which(names(out) == input$dataset)
      mydata &lt;- out[[id]]
      range(mydata)
  
    })
  
    output$range &lt;- renderUI({
      out &lt;- loadPaste()
      id &lt;- which(names(out) == input$dataset)
      mydata &lt;- out[[id]]
      sliderInput("range.in", "Selecte a value in the range of data", min=min(mydata), value=mean(mydata), max=max(mydata), step=diff(range(mydata))/10)
    })
  
    output$range.out &lt;- renderPrint({
      (input$range.in)^2
    })
  
  })
  </code></pre>