When I run my Shiny App I receive the following "Error: missing value where TRUE/FALSE needed" where the ValueBox is not showing.
I reviewed the code and checked if others have the same issue, can you please advise what is wrong in the code below. I appreciate your help
output$lv.rsk <- renderValueBox({
emp.pred_df = ml.out %>%
dplyr::filter(Employee.ID == input$EmpInput)
emp.risk = as.numeric(emp.pred_df$p1)*100
if(emp.risk<10){
valueBox( paste(emp.risk, "%")
,subtitle = tags$p("No Risk of Leaving", style = "font-weight: bold;font-size: 20px")
,icon = icon("street-view")
,color = "blue")
} else if (emp.risk >=10 && emp.risk <= 50) {
valueBox( paste(emp.risk, "%")
,subtitle = tags$p("Low Risk of Leaving", style = "font-weight: bold;font-size: 20px")
,icon = icon("street-view")
,color = "green")
} else if (emp.risk >=50 && emp.risk <= 70) {
valueBox( paste(emp.risk, "%")
,subtitle = tags$p("Medium Risk of Leaving", style = "font-weight: bold;font-size: 20px")
,icon = icon("street-view")
,color = "orange")
} else if (emp.risk>70) {
valueBox( paste(emp.risk, "%")
,subtitle = tags$p("High Risk of Leaving", style = "font-weight: bold;font-size: 20px")
,icon = icon("street-view")
,color = "red")
}
})