I have imported my datasets into my app.R . There is a problem in adding the user inputs to the dataframe and how to get the output as Yes or No after prediction and display the output after using predict() this is my ui dashboad body:
box(mainPanel("ENTER THE DETAILS :",br(),br(),textInput("name","Name :","Name Here"),br(),
numericInput("uiage",'Age :',value = 25,min = 25,max = 100),br(),
radioButtons("uigender","Gender :",c("Male","Female"),inline=TRUE),br(),
textInput("uipurpose","Purpose Of Loan :","Car Loan"),br(),
numericInput("uicredhist",'Cibil Score :',min=1,max=10,value = 9),br(),
numericInput("uicredamt", 'Credit Amount',value = 10000),br(),
numericInput("uicommitment","Intallment Commitment",value =2,min=0,max=6),br(),
radioButtons("uiemplymentstatus","Employment Status :",c("Yes","No"),inline = TRUE),br(),br(),
numericInput("uicheckingstatus",'Checking Status :',min=1,max=10,value = 9),br(),
textInput("uipropmag","Property Magnitude:","real-estate/life-insurance/car/jewels"),br(),
radioButtons("uihousing","Housing :",c("own","rent"),inline = TRUE),br(),
radioButtons("uiforeign","Foreign Worker :",c("yes","no"),inline=TRUE),br(),
radioButtons("uieducation","Educational Qualities :",c("Skilled","Un-Skilled"),inline = TRUE),br(),
actionButton("submit",label = "Submit"),textOutput("text1")))
This is my server logic to get user inputs :
text_reactive1 <- eventReactive( input$submit, {
userage <- input$uiage
})
text_reactive2 <- eventReactive(input$submit,{
usercredithist <- input$uicredhist
})
text_reactive3 <- eventReactive(input$submit,{
usercredamt <- input$uicredamt
})
text_reactive4 <- eventReactive(input$submit,{
usercommit <- input$uicommitment
})
this is my algorithm :
fit <- randomForest(df$class~df$age+df$credit_history+df$credit_amount+df$installment_commitment, data=datfr$df)
randpred <-reactive({ predict(fit,dframe=data.frame(text_reactive1(),text_reactive2(),text_reactive3(),text_reactive4()))})
output$text1 <- renderText({
paste("Input cred hist is :",randpred())
})
I need my output as Yes or no .. can somebody help me solve this..