title: I am new to shiny and I am trying to put a simple app together using the iris data set, which is a package in R:
body: <p>I get the following error:</p>
  
  <pre><code>Error in $.shinyoutput(*tmp*, X) : 
    Reading objects from shinyoutput object not allowed
  </code></pre>
  
  <p>when using the scripts below. ui.R</p>
  
  <pre><code>library(shiny)
  shinyUI(fluidPage(
    titlePanel("Dynamic user interface-RenderUI"),
    sidebarLayout(
      sidebarPanel(
        selectInput("data", "Select the Database of your choice",
                    c("iris"="Iris","mtcars"="mt","trees"="tree")),
        br(),
        helpText("The folowing SelectInput drop down choices are dynamically polulated based on dataset selected"),
        br(),
        uiOutput("X-Axis"),#X-Axis is coming from renderui inserver
        br(),
        uiOutput("Y-Axis")#Y-Axis is coming from renderui inserver
      ),
         mainPanel(
        plotOutput("p")
      )
    )
  ))
  </code></pre>
  
  <p>and server.R</p>
  
  <pre><code>library(shiny)
  shinyServer(function(input, output) {
    var &lt;-reactive({
      switch(input$data,
      "iris"=names(iris),
      "mtcars"=names(mtcars),
      "trees"=names(trees)
      )
  
    })
  
    output$X-Axis &lt;- renderUI({
              selectInput("x-axis", "Select the X-Axis variable",choices = var())
  
  
    })
  
  
    output$Y-Axis &lt;- renderUI({
  
      selectInput("y-axis", "Select the Y-Axis variable",choices = var())
  
  
    })
      output$p &lt;- renderPlot({
  
      attach(get(input$data))
  
      plot(x=get(input$x-axis),y=get(input$y-axis),xlab =input$x-axis,ylab = input$y-axis )
  
      })
   })
  </code></pre>