Reputation: 1079
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.
Upvotes: 1
Views: 3007
Reputation: 3477
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")
)
)
Upvotes: 1