Please modify below code by loan id in R for below data
id no_of_months reminder
1 2 16
2 2 15
3 3 15
4 2 12
5 2 14
I want to apply below formula in 3rd column as no_of_months
.
if(reminder > 0 & reminder < 15){
no_of_months= no_of_months - 1
}
else{
no_of_months
}