There is no way to know the cause with so little information.
R session crashes are very often due to running out of RAM memory. Have you checked your memory allocation when executing the code?
If this doesn't solve your problem, I recommend you to open a separate topic for this new problem, including a REPRoducible EXample (reprex) illustrating your issue.