instance crashing after the following

The general steps to approach RStudio crashing can be found at the following guide;

Another way to improve the chances of people helping is to provide a reproducible example.

A minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

Right now your code refers to data and your environment that folks won't have access to.

You might also provide a public link to your instance.