converted prediction function from for loop to dplyr and went from 1 day to 1 minute for 1.8million records