I have R code in a data generation script that applies a function to a dataframe. The code works, but it runs extremely slowly, and I\'m not sure of the best way to go about mak