Error in SelectInput

I try to run machine learning technique by selecting web view. R gives error in select input: "SelectInput function is not found". I dont understant where exactly i made mistake. Probably it is really basic however, i dont have enough experience in shiny Could you possibly help me?

library(shiny)
library(plyr)
library(mfx)
library(plotly)
library(ggplot2)
library(dplyr)

Define UI for application that draws a barplot via plotly

ui <- shinyUI(pageWithSidebar(
headerPanel = ("Customer Risk Distribution"),

    sidebarPanel( 
        SelectInput("select1", "1.Ürün", choices=c("a1"="a1","a2"="a2",
                                                             "a3"="a3","a4"="a4","a5"="a5")),
        br(),
    
        
        SelectInput("select2","İlçe", choices=c("B1"="B1", "B2"="B2","B3"="B3"))),

mainPanel(
    tabPanel("Summary", textOutput("textDisplay")),
    tabPanel("p",output$plotly()))

))

Define server logic required to draw a barplot

server <- function(input, output) {

##Pre-Data manipulation

Book<-Book1%>%
    filter( AlarmSayisi<= 100,
            TeknikDestekTalebi<= 15,
            MobilDataKullanimi<=30)

Book$MobilDataKullanimi <- ifelse(Book$MobilDataKullanimi>1,1,0)
Book$HizmetSuresi <- Book$HizmetSuresi/12
Book$HizmetSuresi3<-ifelse(Book$HizmetSuresi<=3,1,0)
Book$SikayetSayisi[Book$SikayetSayisi >=1] <-1
Book$TeknikDestekTalebi<-ifelse(Book$TeknikDestekTalebi>1,1,0)
Book$IndirimOrani<-as.numeric(Book$IndirimOrani)
Book$IndirimOrani<-Book$IndirimOrani*100
Book$IndirimOrani[Book$IndirimOrani>0]<-1
Book$IndirimOrani[is.na(Book$IndirimOrani)]=0
Book$CHURN<-recode(Book$CHURN,"VAR"=1, "YOK"=0)


##REACTIVE FUNCTION FOR ML-PROBIT REG

output$select1<-renderUI({
    selectInput("select1","Ürün",choices =c("a1"="a1","a2"="a2","a3"="a3","a4"="a4",
                                            "a5"="a5","a6"="a6","a7"="a7","a8"="a8","a9"="a9","a10"="a10")) })

output$select2<-renderUI({
    selectInput("select2", "İlçe",choices=c("B1"="B1", 
                                            "B2"="B2","B3"="B3"))})



data<-reactive({
a<-Book %>% filter(Urun==(input$select1) & Ilce==(input$select2))

attach(a)
res<-probitmfx(formula=CHURN~ HizmetSuresi3+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
                   ,data = a, 
                   atmean = TRUE, robust = FALSE, clustervar1 = NULL, 
                   clustervar2 = NULL, start = NULL, control = list())

res1<-as.data.frame(res$mfxest)
pi<-select(res1,`dF/dx`,`P>|z|`)

if (pi[1,2] < 0.05) a$HizmetSuresi3 <- a$HizmetSuresi3*pi[1,1]
if (pi[2,2] < 0.05) a$SikayetSayisi <- a$SikayetSayisi*pi[2,1]
if (pi[3,2] < 0.05) a$TeknikDestekTalebi <- a$TeknikDestekTalebi*pi[3,1]
if (pi[4,2] < 0.05) a$MobilDataKullanimi <- a$MobilDataKullanimi*pi[4,1]
if (pi[5,2] < 0.05) a$IndirimOrani <- a$IndirimOrani*pi[5,1]


a$churn.prob<-a$HizmetSuresi3+a$SikayetSayisi+a$TeknikDestekTalebi+a$MobilDataKullanimi+a$IndirimOrani
    
aa<-select(a,c(SUBSCRIPTION_ID,churn.prob,CHURN))
aa
    
aaa <-aa %>% mutate("Risk_level"=
          ifelse(between(churn.prob, -1.10,-0.60), "Very Low Risk",
             ifelse(between(churn.prob, -0.601,-0.20), "Low Risk",
                ifelse(between(churn.prob, -0.201,-0.01), "Medium Risk",
                    ifelse(between(churn.prob,  0,0.20), "High Risk",
                       ifelse(between(churn.prob,  0.201,0.60), "Highest Risk", "NON"))))))

aaa.churnvar<-aaa %>% filter(CHURN==1)
aaa.churnyok<-aaa %>% filter(CHURN==0)

adat.var<-count(aaa.churnvar,Risk_level)
adat.yok<-count(aaa.churnyok,Risk_level)
adat.yok$n2<-adat.yok$n
adat1<-left_join(adat.var, adat.yok, by = c("Risk_level"))
adat1

})

library(forcats)    ##ggplotly for result
library(ggplot2)
library(plotly)

output$plotly<-renderPlotly({

p <- plot_ly(adat1, x = ~Risk_level, y = ~n.x, type = 'bar', name = 'Churn Var') %>%
    add_trace(y = ~n2, name = 'Churn Yok') %>%
    layout(xaxis = list(title = "",
       categoryorder = "array",
       categoryarray = c("Very Low Risk","Low Risk",
                           "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = ""))
         

p  %>% config(displayModeBar = F)



})

output$textDisplay<- renderText({
    paste(output$select1, "ve",output$select2)
})

}

shinyApp(ui = ui, server = server)

SelectInput should be replaced with selectInput. (lowercase 's').

thanks it works!. is was out of my concentration. But, now, new problem occur: "output object is not found!"

Try this,

tabPanel("p", plotlyOutput("Display"))

in server logic, your code wasn't reproducible hence I used,

 output$Display <- renderPlotly({
        plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)})

OR, looking at your code, I would write the server logic for graph as

# As above
p <- plot_ly(adat1, x = ~Risk_level, y = ~n.x, type = 'bar', name = 'Churn Var') %>%
    add_trace(y = ~n2, name = 'Churn Yok') %>%
    layout(xaxis = list(title = "",
       categoryorder = "array",
       categoryarray = c("Very Low Risk","Low Risk",
                           "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = ""))
   

p  %>% config(displayModeBar = F)

output$Display <- renderPlotly({p})

Is it working now?

It reflects web page but "Error:Reading from shinyoutput object is not allowed." is written on the top of page. When i change the select1 or select2, graph does not change.

Error in $.shinyoutput: Reading from shinyoutput object is not allowed.

It does not process the part of data manipulation with respect to user selection. How can i do this?

update ui code as

ui <- shinyUI(pageWithSidebar(
    headerPanel = ("Customer Risk Distribution"),
    sidebarPanel( 
       uiOutput("select1"), #replaced selectInput to uiOutput
        br(),
        
        uiOutput("select2")),
    
    mainPanel(
        tabPanel("Summary", textOutput("textDisplay")),
        tabPanel("p", plotlyOutput("Display"))
    
)))

See if this works for, data manipulation w.r.t. user selection.

i did but, this error occurs:
Warning in ..stacktraceon..({ : Zorlamadan dolayı ortaya çıkan NAs
Error in if (inline) span else div :
argument is not logically interpretative -

I share last version of codes, please look one more time, thanks a lot! it going really useful and instructive!

This is a Shiny web application. You can run the application by clicking

the 'Run App' button above.

##Pre-Data manipulation

Book<-Book1%>%
filter( AlarmSayisi<= 100,
TeknikDestekTalebi<= 15,
MobilDataKullanimi<=30)

Book$MobilDataKullanimi <- ifelse(Book$MobilDataKullanimi>1,1,0)
Book$HizmetSuresi <- Book$HizmetSuresi/12
Book$HizmetSuresi3<-ifelse(Book$HizmetSuresi<=3,1,0)
Book$SikayetSayisi[Book$SikayetSayisi >=1] <-1
Book$TeknikDestekTalebi<-ifelse(Book$TeknikDestekTalebi>1,1,0)
Book$IndirimOrani<-as.numeric(Book$IndirimOrani)
Book$IndirimOrani<-Book$IndirimOrani*100
Book$IndirimOrani[Book$IndirimOrani>0]<-1
Book$IndirimOrani[is.na(Book$IndirimOrani)]=0
Book$CHURN<-recode(Book$CHURN,"VAR"=1, "YOK"=0)

Find out more about building applications with Shiny here:

http://shiny.rstudio.com/

library(shiny)
library(plyr)
library(mfx)
library(plotly)
library(ggplot2)
library(dplyr)
library(forcats)

Define UI for application that draws a histogram

ui <- shinyUI(

pageWithSidebar(
          sidebarLayout(
    uiOutput("select1","Ürün",choices =c("a1"="a1","a2"="a2",
                               "a3"="a3","a4"="a4","a5"="a5")), #replaced selectInput to uiOutput
    br(),
    
    uiOutput("select2", "İlçe",choices=c("b1"="b1", 
                                         "b2"="b2","b3"="b3")),

mainPanel(
    titlePanel("ML Result: Risk Distribution"),
    tabPanel("pp", plotlyOutput("Display"))))

))

Define server logic required to draw a histogram

server <- function(input, output) {

output$select1<-renderUI({
    uiOutput("select1","Ürün",choices =c("a1"="a1","a2"="a2",
                                         "a3"="a3","a4"="a4","a5"="a5")) })

output$select2<-renderUI({
    uiOutput("select2", "İlçe",choices=c("b1"="b1", 
                                         "b2"="b2","b3"="b3"))})



##REACTIVE FUNCTION FOR ML-PROBIT REG


data<-reactive({
a<-Book %>% filter(Urun==(input$select1) & Ilce==(input$select2))

attach(a)
res<-probitmfx(formula=CHURN~ HizmetSuresi3+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
                   ,data = a, 
                   atmean = TRUE, robust = FALSE, clustervar1 = NULL, 
                   clustervar2 = NULL, start = NULL, control = list())

res1<-as.data.frame(res$mfxest)
pi<-select(res1,`dF/dx`,`P>|z|`)

if (pi[1,2] < 0.05) a$HizmetSuresi3 <- a$HizmetSuresi3*pi[1,1]
if (pi[2,2] < 0.05) a$SikayetSayisi <- a$SikayetSayisi*pi[2,1]
if (pi[3,2] < 0.05) a$TeknikDestekTalebi <- a$TeknikDestekTalebi*pi[3,1]
if (pi[4,2] < 0.05) a$MobilDataKullanimi <- a$MobilDataKullanimi*pi[4,1]
if (pi[5,2] < 0.05) a$IndirimOrani <- a$IndirimOrani*pi[5,1]


a$churn.prob<-a$HizmetSuresi3+a$SikayetSayisi+a$TeknikDestekTalebi+a$MobilDataKullanimi+a$IndirimOrani
    
aa<-select(a,c(SUBSCRIPTION_ID,churn.prob,CHURN))
aa
    
aaa <-aa %>% mutate("Risk_level"=
          ifelse(between(churn.prob, -1.10,-0.60), "Very Low Risk",
             ifelse(between(churn.prob, -0.601,-0.20), "Low Risk",
                ifelse(between(churn.prob, -0.201,-0.01), "Medium Risk",
                    ifelse(between(churn.prob,  0,0.20), "High Risk",
                       ifelse(between(churn.prob,  0.201,0.60), "Highest Risk", "NON"))))))

aaa.churnvar<-aaa %>% filter(CHURN==1)
aaa.churnyok<-aaa %>% filter(CHURN==0)


adat.var<-count(aaa.churnvar,"Risk_level")
adat.yok<-count(aaa.churnyok,"Risk_level")
adat.yok$n2<-adat.yok$n
adat1<-left_join(adat.var, adat.yok, by = c("Risk_level"))
adat1
})

##plotly

p <- plot_ly(adat1, x = ~Risk_level, y = ~freq.x, type = 'bar', name = 'Churn Var') %>%
    add_trace(y = ~freq.y, name = 'Churn Yok') %>%
    layout(xaxis = list(title = "",
       categoryorder = "array",
       categoryarray = c("Very Low Risk","Low Risk",
                           "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = "")) 
pp<-p %>% config(displayModeBar = F)  

output$Display <- renderPlotly({pp})

})

}

shinyApp(ui = ui, server = server)

In, ui logic no need to give label and choices

 uiOutput("select1","Ürün",choices =c("a1"="a1","a2"="a2",
                               "a3"="a3","a4"="a4","a5"="a5")),  # Only put ID

Replace above method with,

 uiOutput("select1"), # Similarly for select 2

The input choices are provided in server code. (in renderUI method )

I did it. Error is reoccur:
Warning in ..stacktraceon..({ : Zorlamadan dolayı ortaya çıkan NAs
Error in match.arg(position) : 'arg' must be NULL or a character vector

The solution I came up with,

ui <- fluidPage(
    
        sidebarPanel(
            
            uiOutput("select1"),
            uiOutput("select2")),
            
            mainPanel(
                titlePanel("ML Result: Risk Distribution"),
                tabPanel("pp", plotlyOutput("Display"))
                      )
                 )

Is this helpful.

unfortunatelly :confused:
same error occurs

To avoid this unnecessary back and forths, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one for a shiny app

I guess you have added extra brackets '})' in server logic, at the last. Remove them and check.
The program would look like this

ui <- shinyUI(
   fluidPage(
        sidebarPanel(
            
            uiOutput("select1"),
            uiOutput("select2")),
            
            mainPanel(
                titlePanel("ML Result: Risk Distribution"),
                tabPanel("pp"))
    ))


server <- function(input, output) {
    output$select1<-renderUI({
        uiOutput("select1","Ürün",choices =c("a1"="a1","a2"="a2",
                                             "a3"="a3","a4"="a4","a5"="a5")) })

    output$select2<-renderUI({
        uiOutput("select2", "İlçe",choices=c("b1"="b1",
                                             "b2"="b2","b3"="b3"))})



    ##REACTIVE FUNCTION FOR ML-PROBIT REG


    data<-reactive({
        a<-Book %>% filter(Urun==(input$select1) & Ilce==(input$select2))

        attach(a)
        res<-probitmfx(formula=CHURN~ HizmetSuresi3+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
                       ,data = a,
                       atmean = TRUE, robust = FALSE, clustervar1 = NULL,
                       clustervar2 = NULL, start = NULL, control = list())

        res1<-as.data.frame(res$mfxest)
        pi<-select(res1,`dF/dx`,`P>|z|`)

        if (pi[1,2] < 0.05) a$HizmetSuresi3 <- a$HizmetSuresi3*pi[1,1]
        if (pi[2,2] < 0.05) a$SikayetSayisi <- a$SikayetSayisi*pi[2,1]
        if (pi[3,2] < 0.05) a$TeknikDestekTalebi <- a$TeknikDestekTalebi*pi[3,1]
        if (pi[4,2] < 0.05) a$MobilDataKullanimi <- a$MobilDataKullanimi*pi[4,1]
        if (pi[5,2] < 0.05) a$IndirimOrani <- a$IndirimOrani*pi[5,1]


        a$churn.prob<-a$HizmetSuresi3+a$SikayetSayisi+a$TeknikDestekTalebi+a$MobilDataKullanimi+a$IndirimOrani

        aa<-select(a,c(SUBSCRIPTION_ID,churn.prob,CHURN))
        aa

        aaa <-aa %>% mutate("Risk_level"=
                                ifelse(between(churn.prob, -1.10,-0.60), "Very Low Risk",
                                       ifelse(between(churn.prob, -0.601,-0.20), "Low Risk",
                                              ifelse(between(churn.prob, -0.201,-0.01), "Medium Risk",
                                                     ifelse(between(churn.prob,  0,0.20), "High Risk",
                                                            ifelse(between(churn.prob,  0.201,0.60), "Highest Risk", "NON"))))))

        aaa.churnvar<-aaa %>% filter(CHURN==1)
        aaa.churnyok<-aaa %>% filter(CHURN==0)


        adat.var<-count(aaa.churnvar,"Risk_level")
        adat.yok<-count(aaa.churnyok,"Risk_level")
        adat.yok$n2<-adat.yok$n
        adat1<-left_join(adat.var, adat.yok, by = c("Risk_level"))
        adat1
    })

    p <- plot_ly(adat1, x = ~Risk_level, y = ~freq.x, type = 'bar', name = 'Churn Var') %>%
        add_trace(y = ~freq.y, name = 'Churn Yok') %>%
        layout(xaxis = list(title = "",
                            categoryorder = "array",
                            categoryarray = c("Very Low Risk","Low Risk",
                                              "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = ""))
    pp<-p %>% config(displayModeBar = F)

    output$Display <- renderPlotly({pp})


}
shinyApp(ui = ui, server = server)

Is this working?

it does not work, user selection boxes are gone!

replaced 'uiOutput' with 'selectInput' in ui logic and removed 'renderUI' from server side

ui <- shinyUI(
   fluidPage(
        sidebarPanel(
            
            selectInput("select1","Ürün",choices =c("a1"="a1","a2"="a2",
                                                   "a3"="a3","a4"="a4","a5"="a5")),
            selectInput("select2", "İlçe",choices=c("b1"="b1",
                                                     "b2"="b2","b3"="b3"))),
            
               mainPanel(
                titlePanel("ML Result: Risk Distribution"),
                tabPanel("pp"))
    ))

server <- function(input, output) {
    

    ##REACTIVE FUNCTION FOR ML-PROBIT REG


    data<-reactive({
        a<-Book %>% filter(Urun==(input$select1) & Ilce==(input$select2))

        attach(a)
        res<-probitmfx(formula=CHURN~ HizmetSuresi3+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
                       ,data = a,
                       atmean = TRUE, robust = FALSE, clustervar1 = NULL,
                       clustervar2 = NULL, start = NULL, control = list())

        res1<-as.data.frame(res$mfxest)
        pi<-select(res1,`dF/dx`,`P>|z|`)

        if (pi[1,2] < 0.05) a$HizmetSuresi3 <- a$HizmetSuresi3*pi[1,1]
        if (pi[2,2] < 0.05) a$SikayetSayisi <- a$SikayetSayisi*pi[2,1]
        if (pi[3,2] < 0.05) a$TeknikDestekTalebi <- a$TeknikDestekTalebi*pi[3,1]
        if (pi[4,2] < 0.05) a$MobilDataKullanimi <- a$MobilDataKullanimi*pi[4,1]
        if (pi[5,2] < 0.05) a$IndirimOrani <- a$IndirimOrani*pi[5,1]


        a$churn.prob<-a$HizmetSuresi3+a$SikayetSayisi+a$TeknikDestekTalebi+a$MobilDataKullanimi+a$IndirimOrani

        aa<-select(a,c(SUBSCRIPTION_ID,churn.prob,CHURN))
        aa

        aaa <-aa %>% mutate("Risk_level"=
                                ifelse(between(churn.prob, -1.10,-0.60), "Very Low Risk",
                                       ifelse(between(churn.prob, -0.601,-0.20), "Low Risk",
                                              ifelse(between(churn.prob, -0.201,-0.01), "Medium Risk",
                                                     ifelse(between(churn.prob,  0,0.20), "High Risk",
                                                            ifelse(between(churn.prob,  0.201,0.60), "Highest Risk", "NON"))))))

        aaa.churnvar<-aaa %>% filter(CHURN==1)
        aaa.churnyok<-aaa %>% filter(CHURN==0)


        adat.var<-count(aaa.churnvar,"Risk_level")
        adat.yok<-count(aaa.churnyok,"Risk_level")
        adat.yok$n2<-adat.yok$n
        adat1<-left_join(adat.var, adat.yok, by = c("Risk_level"))
        adat1
    })

    p <- plot_ly(adat1, x = ~Risk_level, y = ~freq.x, type = 'bar', name = 'Churn Var') %>%
        add_trace(y = ~freq.y, name = 'Churn Yok') %>%
        layout(xaxis = list(title = "",
                            categoryorder = "array",
                            categoryarray = c("Very Low Risk","Low Risk",
                                              "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = ""))
    pp<-p %>% config(displayModeBar = F)

    output$Display <- renderPlotly({pp})


}
shinyApp(ui = ui, server = server)

everthing is done except for user control of calculation.

i add radio button for the availability to change estimation. If we handle user reactivity, problem will solved.

library(shiny)
library(plyr)
library(mfx)
library(plotly)
library(ggplot2)
library(dplyr)
library(forcats)

Define UI for application that draws a plotly

ui <- shinyUI(
fluidPage(
sidebarLayout(
sidebarPanel(

    # Sidebar with a slider input

    selectInput("select1", "Ürün", choices = c("a1"="a1","a2"="a2",
                                 "a3"="a3","a4"="a4","a5"="a5")),
   
    selectInput("select2", "İlçe",choices=c("b1"="b1", 
                                            "b2"="b2","b3"="b3")),
    radioButtons(inputId = "mltype",
                 label = "Makine Öğrenim Tipi", 
                 choices = list("LR-Probit"="probitmfx","LR-Logit"="logitmfx")),position="right"),

mainPanel(
    titlePanel("ML Result: Risk Distribution"),
    tabPanel("pp", plotlyOutput("Display")))))

)

Define server logic required to draw a plotly

server <- function(input, output) {

##REACTIVE FUNCTION FOR ML-PROBIT REG
data<-reactive({
a<-Book %>% filter(Urun==(input$select1) & Ilce==(input$select2))

attach(a)
res<-input$mltype(formula=CHURN~ HizmetSuresi3+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
                   ,data = a, 
                   atmean = TRUE, robust = FALSE, clustervar1 = NULL, 
                   clustervar2 = NULL, start = NULL, control = list())

res1<-as.data.frame(res$mfxest)
pi<-select(res1,`dF/dx`,`P>|z|`)

if (pi[1,2] < 0.05) a$HizmetSuresi3 <- a$HizmetSuresi3*pi[1,1]
if (pi[2,2] < 0.05) a$SikayetSayisi <- a$SikayetSayisi*pi[2,1]
if (pi[3,2] < 0.05) a$TeknikDestekTalebi <- a$TeknikDestekTalebi*pi[3,1]
if (pi[4,2] < 0.05) a$MobilDataKullanimi <- a$MobilDataKullanimi*pi[4,1]
if (pi[5,2] < 0.05) a$IndirimOrani <- a$IndirimOrani*pi[5,1]


a$churn.prob<-a$HizmetSuresi3+a$SikayetSayisi+a$TeknikDestekTalebi+a$MobilDataKullanimi+a$IndirimOrani
    
aa<-select(a,c(SUBSCRIPTION_ID,churn.prob,CHURN))
aa
    
aaa <-aa %>% mutate("Risk_level"=
          ifelse(between(churn.prob, -1.10,-0.60), "Very Low Risk",
             ifelse(between(churn.prob, -0.601,-0.20), "Low Risk",
                ifelse(between(churn.prob, -0.201,-0.01), "Medium Risk",
                    ifelse(between(churn.prob,  0,0.20), "High Risk",
                       ifelse(between(churn.prob,  0.201,0.60), "Highest Risk", "NON"))))))

aaa.churnvar<-aaa %>% filter(CHURN==1)
aaa.churnyok<-aaa %>% filter(CHURN==0)


adat.var<-count(aaa.churnvar,"Risk_level")
adat.yok<-count(aaa.churnyok,"Risk_level")
adat.yok$n2<-adat.yok$n
adat1<-left_join(adat.var, adat.yok, by = c("Risk_level"))
adat1
})

##plotly

p <- plot_ly(adat1, x = ~Risk_level, y = ~freq.x, type = 'bar', name = 'Churn Var') %>%
    add_trace(y = ~freq.y, name = 'Churn Yok') %>%
    layout(xaxis = list(title = "",
       categoryorder = "array",
       categoryarray = c("Very Low Risk","Low Risk",
                           "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = "")) 
pp<-p %>% config(displayModeBar = F)  

output$Display <- renderPlotly({pp})

}

shinyApp(ui = ui, server = server)

Since, I cannot run the script in my PC hence, with intuition I am giving the solution
In server logic try

server <- function(input, output) {
 
  observe({
    
    a<-Book %>% filter(Urun==(input$select1) & Ilce==(input$select2))
    observeEvent(input$mltype,{
    if(input$mltype=="probitmfx"){
      res <- probitmfx(formula=CHURN~ HizmetSuresi3+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
                       ,data = a, 
                       atmean = TRUE, robust = FALSE, clustervar1 = NULL, 
                       clustervar2 = NULL, start = NULL, control = list())
    }
    if(input$mltype=="logitmfx"){
      res <- logitmfx(formula=CHURN~ HizmetSuresi3+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
                      ,data = a, 
                      atmean = TRUE, robust = FALSE, clustervar1 = NULL, 
                      clustervar2 = NULL, start = NULL, control = list())
    }
    
    res1<-as.data.frame(res$mfxest)
    pi<-select(res1,`dF/dx`,`P>|z|`)
    
    if (pi[1,2] < 0.05) a$HizmetSuresi3 <- a$HizmetSuresi3*pi[1,1]
    if (pi[2,2] < 0.05) a$SikayetSayisi <- a$SikayetSayisi*pi[2,1]
    if (pi[3,2] < 0.05) a$TeknikDestekTalebi <- a$TeknikDestekTalebi*pi[3,1]
    if (pi[4,2] < 0.05) a$MobilDataKullanimi <- a$MobilDataKullanimi*pi[4,1]
    if (pi[5,2] < 0.05) a$IndirimOrani <- a$IndirimOrani*pi[5,1]
    
    
    a$churn.prob<-a$HizmetSuresi3+a$SikayetSayisi+a$TeknikDestekTalebi+a$MobilDataKullanimi+a$IndirimOrani
    
    aa<-select(a,c(SUBSCRIPTION_ID,churn.prob,CHURN))
    aa
    
    aaa <-aa %>% mutate("Risk_level"=
                          ifelse(between(churn.prob, -1.10,-0.60), "Very Low Risk",
                                 ifelse(between(churn.prob, -0.601,-0.20), "Low Risk",
                                        ifelse(between(churn.prob, -0.201,-0.01), "Medium Risk",
                                               ifelse(between(churn.prob,  0,0.20), "High Risk",
                                                      ifelse(between(churn.prob,  0.201,0.60), "Highest Risk", "NON"))))))
    
    aaa.churnvar<-aaa %>% filter(CHURN==1)
    aaa.churnyok<-aaa %>% filter(CHURN==0)
    
    
    adat.var<-count(aaa.churnvar,"Risk_level")
    adat.yok<-count(aaa.churnyok,"Risk_level")
    adat.yok$n2<-adat.yok$n
    adat1<-left_join(adat.var, adat.yok, by = c("Risk_level"))
    adat1
    
    p <- plot_ly(adat1, x = ~Risk_level, y = ~freq.x, type = 'bar', name = 'Churn Var') %>%
      add_trace(y = ~freq.y, name = 'Churn Yok') %>%
      layout(xaxis = list(title = "",
                          categoryorder = "array",
                          categoryarray = c("Very Low Risk","Low Risk",
                                            "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = "")) 
    pp<-p %>% config(displayModeBar = F)  
    
    output$Display <- renderPlotly({pp})
 
    
    })
    
   
  })
  
}
shinyApp(ui = ui, server = server)

Note: 1. replaced reactive with observe
2. Added if condition for choice in radio button

I did you said. But, when i change the Ürün selection, web view was directly closed. And i guess observe function does not work. because , when i change the radio button, nothing changes in the graph

I tried to run your script with another dataset.
Note:- don't go for algorithm, what I did is all mathematically wrong.
Follow, the procedure and replace Biopsy dataset with your dataset(Book)

library(shiny)
library(plyr)
library(mfx)
library(plotly)
library(ggplot2)
library(dplyr)
library(forcats)
library(MASS) # has biposy dataset or else not required

ui <- shinyUI(
  fluidPage(
    sidebarLayout(
      sidebarPanel(
        # Sidebar with a slider input
        
        selectInput("select1", "Ürün", choices = levels(factor(biopsy$class))), # Change as you needed
        
        selectInput("select2", "İlçe",choices= levels(factor(biopsy$V1))), # Change as you needed
        radioButtons(inputId = "mltype",
                     label = "Makine Öğrenim Tipi", 
                     choices = list("LR-Probit"="probitmfx","LR-Logit"="logitmfx")),position="right"),
      
      mainPanel(
        titlePanel("ML Result: Risk Distribution"),
        tabPanel("pp", plotlyOutput("Display")),br(),
        dataTableOutput("xx"))))
)
#Server LOGIC
server <- function(input, output) {
  
  observe({
  
    a <- biopsy%>% filter(class==(input$select1) & V1>=(input$select2))  # biopsy dataset is used for testing
    
     a$CHURN = a$V1+a$V2+a$V3+a$V4+a$V5+a$V6+a$V7+a$V8+a$V9  # I added it 
   
      observeEvent(input$mltype,{
      if(input$mltype=="probitmfx"){
        res <- probitmfx(formula=class~ V1+V2+V3+V4+V5+V6+V7+V8+V9,data = a)  # change the formula, to as you made
        res$mfxest <- res$mfxest - 10  # I added it (remove it) 
      }
      if(input$mltype=="logitmfx"){
        res <- logitmfx(formula= class~ (V1+V2+V3+V4+V5+V6+V7+V8+V9),data = a)# change the formula, to as you made
        res$mfxest <- res$mfxest+10  # I added it (remove it) 
      }
      
      res1 <- as.data.frame(res$mfxest)
      pi <- select(res1,`dF/dx`,`P>|z|`)
      
      if (pi[1,2] < 0.05) a$V1 <- a$V1*pi[1,1]
      if (pi[2,2] < 0.05) a$V2 <- a$V2*pi[2,1]
      if (pi[3,2] < 0.05) a$V3 <- a$V3*pi[3,1]
      if (pi[4,2] < 0.05) a$V4 <- a$V4*pi[4,1]
      if (pi[5,2] < 0.05) a$V5 <- a$V5*pi[5,1]
      if (pi[6,2] < 0.05) a$V6 <- a$V6*pi[6,1]
      if (pi[7,2] < 0.05) a$V7 <- a$V7*pi[7,1]
      if (pi[8,2] < 0.05) a$V8 <- a$V8*pi[8,1]# I added, it remove it
      if (pi[9,2] < 0.05) a$V9 <- a$V9*pi[9,1]# I added, it remove it
      
      a$churn.prob<-a$V1+a$V2+a$V3+a$V4+a$V5+a$V6+a$V7+a$V8+a$V9 #Change the formula as needed
      
      aa <- select(a,c(ID,churn.prob,CHURN)) # rename ID back to SUBSCRIPTION_ID
      
      aaa <- aa %>% mutate("Risk_level"= 
                            ifelse(between(churn.prob, 1,5), "Very Low Risk",
                                   ifelse(between(churn.prob, 6,10), "Low Risk",
                                          ifelse(between(churn.prob, 11,13), "Medium Risk",
                                                 ifelse(between(churn.prob,  14,16), "High Risk",
                                                        ifelse(between(churn.prob, 16,50), "Highest Risk", "NON")))))) # Correct ifelse values (I changed them) 
      
      aaa.churnvar<-aaa %>% filter(CHURN<=10)  #Correct it
      aaa.churnyok<-aaa %>% filter(CHURN>10)   #Correct it
      
      
      adat.var<- count(aaa.churnvar,"Risk_level")
      adat.yok<-count(aaa.churnyok,"Risk_level")
      adat.yok$n2<-adat.yok$n
      adat1<-left_join(adat.var, adat.yok)

      p <- plot_ly(aaa.churnvar, x = ~Risk_level, y = ~churn.prob, type = 'bar', name = 'Churn Var') %>%
        add_trace(y = ~CHURN, name = 'Churn Yok') %>%
        layout(xaxis = list(title = "",
                            categoryorder = "array",
                            categoryarray = c("Very Low Risk","Low Risk",
                                              "Medium Risk","High Risk","Highest Risk"),barmode = 'group'),yaxis = list(title = "")) 
      pp<-p %>% config(displayModeBar = F)  
      
      output$Display <- renderPlotly({pp})
      
      
    })
    
    
  })
  
}
shinyApp(ui = ui, server = server)

Copy and paste the script. It will run,
Chart will update when you change options from radio button and selectInput's.
Not all options generate chart due to incorrect mathematical formulations, but still chart is updated.

Check, for errors and typos and incorrect bracket placements in your script, and update them w.r.t this script or,
change the above script to work with your data.