Create a Function and Prepare Test Data in R | Finance Train