My reprex. Although, it's running but it's not changing the values.
library(shiny)
library(shinydashboardPlus)
library(shinydashboard)
library(shinyjs)
library(shinyWidgets)
library(tidyverse)
library(dplyr)
library(excelR)
library(readxl)
library(readr)
library(rsconnect)
library(gtools)
library(excelR)
library(readxl)
library(haven)
library(arules)
library(MASS)
library(rsample)
library(flextable)
library(reshape2)
library(DT)
dt<- data.frame("Discipline"=c("IT", "Computer", "Arts", "IT", "Business", "Pyschology"),
"Specialization"=c("IT Networking", "Computer Networks", "Arts and Culture", "Software Engineering",
"Management", "Pyschology"),
"Programs"=c("Bachelors in Networking", "Bachelors in Computer Scienc", "Bachelors in Arts", "Masters in Security Analysis",
"Bachelors in Business Management", "Bachelors in Pyschology"))
ui<- fluidPage(
titlePanel("Links"),
fluidRow(column( width = 8,
div(
uiOutput('item'),
renderDataTable("t1"),
actionButton("send", "Send")
)
)))
# Defining Server Controls
server<- function(input, output, session)
{
observeEvent(input$send,{
insertUI(selector = "#send", where = "beforeBegin",
ui=div(class="chat-bubbles",
div(class="bubble",
wellPanel(
p("What are your preferred disciplines?", tags$br(),
selectInput("grad_courses", "Disciplines", choices =sort(unique(as.character(dt$Discipline) ))
)
)))))
})
observeEvent(input$grad_courses,{
insertUI(selector = "#send", where = "beforeBegin",
ui=div(class="chat-bubbles",
div(class="bubble",
wellPanel(
output$item<- renderUI({
selectInput("specialization", "Specilisation", choices =sort(unique(as.character(graduate_spec() ))
))
})
))))
})
# Check for Level 9
observeEvent(input$specialization,{
insertUI(selector = "#send", where = "beforeBegin",
ui=div(class="chat-bubbles",
div(class="bubble",
wellPanel(
p("You are eligible for the courses mentioned below:"),
output$t1 <- shiny::renderDataTable({
enframe(paste0(grad_prgm() ),value="link",name=NULL)
}, escape=FALSE,
options = list(dom = 't',
searching= FALSE))
))))
})
## graduation values
graduate_spec<- reactive({
dt%>% filter(Discipline== input$grad_courses)%>%
pull(Specialization)
})
grad_prgm<- reactive({
z<-dt %>% filter(Discipline == input$grad_courses, Specialization == graduate_spec()) %>%
pull(Programs)
return(z)
})
}
shinyApp(ui,server)