1

I wrote this code and initially Shiny worked just fine and the app started:

library(shiny)    
ui <- fluidPage(
  titlePanel("Title"),
  sidebarPanel(
    sliderInput("priceInput", "Price", min = 0, max = 100,
                value = c(25,40), pre = "$")
  ),
  mainPanel("Results")
)

But when I add any UI element to it, for example radioButton:

ui <- fluidPage(
  titlePanel("Title"),
  sidebarPanel(
    sliderInput("priceInput", "Price", min = 0, max = 100,
                value = c(25,40), pre = "$"),
    radioButtons("typeInput", "Product type",
                 choices = c("p1", "p2", "p3"),
                 selected = "p1")
  ),
  mainPanel("Results")
)

I get an error:

Shiny couldn't find any UI for this application. We looked in:    
www/index.html
ui.R
app.R

Any idea what might cause this? I tried other options instead of a radio button and received the same error. My server file is just an empty file with the server function.

cmaher
  • 5,100
  • 1
  • 22
  • 34
Digvijay Sawant
  • 1,049
  • 3
  • 16
  • 32
  • how did you run app? and you should provide a reproducible example. – MLavoie Apr 26 '18 at 17:33
  • Not sure what you are trying to ask but I ran it on R studio console and browser too. could you please elaborate on provide a reproducible example? – Digvijay Sawant Apr 26 '18 at 18:18
  • see that link: https://stackoverflow.com/questions/48343080/how-to-convert-a-shiny-app-consisting-of-multiple-files-into-an-easily-shareable – MLavoie Apr 26 '18 at 18:19

1 Answers1

1

Add the elements inside a sidebarLayout(...)

ui <- fluidPage(
  titlePanel("title panel"),

  sidebarLayout(
    sidebarPanel(
         sliderInput("priceInput", "Price", min = 0, max = 100,
            value = c(25,40), pre = "$"),
         radioButtons("typeInput", "Product type",
             choices = c("p1", "p2", "p3"),
             selected = "p1")),ț
    )
    mainPanel("main panel")
  )
)
Teodor Ciuraru
  • 3,417
  • 1
  • 32
  • 39