I'm working with a data.table in R with ~6e6 rows and I created a function that I pass through data.table to create a new column based on two grouping values. Technically, my function loops through each row of the grouped arguments and does some very simple algebraic operations, but given the size of my data.table, this will take quite some time.
I'm familiar with the foreach() function and other functions that use multiple cores for computing, but I haven't read or come across a way to use parallelization to speed up a for-loop that specified within a function that's passed through data.table. Essentially, I want each for loop iteration to be handled by multiple cores opposed to one. Has anyone had experience with this and/or implemented this within data.table while using a user specified function containing a for-loop?