I'm currently coding an insurance premium tool, which needs to link a formula for specific contract, i.e. pure endowment (survival benefit)
In order to do so, it needs a population vector based on the age input on the sliderInput, which I already have prepared in a dataframe.
But I'm not sure how to link the formula to R, like how do I say to R, for any age input and any benefit term, we can take data from the dataframe.
Additional background:
kPx = probablity aged x lives another k years
The formula to calculate kPx:
kPx = population at x+k / population at x.
I've got the population vector in a dataframe, i just need to tell R for a certain age and certain benefit term, we'll get it from the specific dataframe.