How do I handle an incoming POST request in a module?
If posting to external URLs is allowed, and given that you are not familiar with Drupal, you can post that data to an external URL where you can write a script using the language / framework you are familiar with and process the data. Especially since you are only looking to process the data with R.

If you want to manage your processing within Drupal itself that is also doable. You will have to write a custom controller in your module, add the route in the module.routing.yml file and then handle the POST data in your controller.

Here are couple of places you can start

https://www.drupal.org/docs/8/api/routing-system/introductory-drupal-8-routes-and-controllers-example

How to get $_POST and $_GET parameters