How do I handle an incoming POST request in a module? I am really new to Drupal but I have to do a project using it and I was just wondering how to handle an incoming POST request in a module:

I am creating a module that will get incoming data from a Webform, process the data by running an R script on it, and then return the result of the R function on the data to the url path specified in the module, but I am not sure at all how to begin handling POST requests - can someone give me some insight? In Webform settings you can specify a URL to send a POST request with the form data upon submission, but if I can figure out how to handle that data I will be golden!
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