RStudio stopped running code

I think this is because you are missing the closing bracket in your last function definition.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.