Include R-based documentation

Writes the code comments into [ROxygen](https://github.com/klutometis/roxygen) style comments that can be used to automatically generate R's internal documentation of the main function.