Hi ,
I have a data frame book3, it has three columns Region, Country and rating. I want to create a dependent column. see my code below
UI.R
library(shiny)
ui <- fluidPage(
titlePanel("Test Dashboard "),
sidebarLayout(
sidebarPanel(
uiOutput("data1"), ## uiOutput - gets the UI from the server
uiOutput("data2")
),
mainPanel()
))
--
Server.r
library(shiny)
shinyServer(function(input, output) {
Region<- c("Americas", "Asia Pacific","Asia Pacific", "EMEA", "EMEA")
Country<- c("Mexico", "China","India", "Germany", "Spain" )
Rating<- c(5,3,3,2,4)
book3<- data.frame(Region, Country, Rating, stringsAsFactors = F)
output$data1 <- renderUI({
selectInput("data1", "Select Region", choices = c(book3$Region))
})
output$data2 <- renderUI({
selectInput("data2", "select Country", choices = c(book3$Country))
})
})