Use data.table instead of pivot.longer

I do not have experience with tracking computation time. The last post in the following thread has an example.