I am trying to write a vectorized function. Here is pseudocode using the data.frame "final". BID_AMOUNT/Duration * Probability * bill_factor
where bill_fact