I am working on R(Shiny) that is working on a loan prediction model. I am trying to calculate loan amount for a particular method but it is showing me an error for infinite recursion and just like mentioned in most of the posts even I have tried options(expressions = 1000) value, but am still experiencing the error.
If I write my condition as
MDBB_LA<- reactive({ input$MDBB*10 })
then it is giving me no error but if I add another condition on this as
DSCR_Post<- reactive({
if (input$MU == "EMM" & (input$EMIM/12)+EMI()!=0) {
EBITDA_EMM()/((input$EMIM/12) + EMI())
} else if (input$MU == "EMM" & (input$EMIM/12)+EMI()==0) {
0
} else if (input$MU != "EMM" & (input$EMIM/12)+EMI()!=0 ){
EBITDA()/((input$EMIM/12) + EMI())
}else{
0
}})
MDBB_LA<- reactive({ if ((input$MU == "EMM" & DSCR_Post() >= 1) | (input$MU == "FAT1" & DSCR_Post() >= 0.8) | (input$MU == "FAT2" & DSCR_Post() >= 0.7) | (input$MU == "UAT" & DSCR_Post() >= 0.5)) {
input$MDBB*10*2
} else if ((input$MU == "EMM" & DSCR_Post() < 1) | (input$MU == "FAT1" & DSCR_Post() < 0.8 ) | (input$MU == "FAT2" & DSCR_Post() < 0.7) | (input$MU == "UAT" & DSCR_Post() < 0.5)){
input$MDBB*10
} else if ((input$MU == "MDBB1" ) | (input$MU == "MDBB2" ) | (input$MU == "MDBB3") | (input$MU == "MDBB4") ){
input$MDBB*10
} else {input$MDBB*10}
})
then it is showing me error as :
Warning: Error in : evaluation nested too deeply: infinite recursion / options(expressions=)?
Anyone who can help me, what is going wrong with the logical statement.