This weekend I decided to create my first R package… it’s here!
Although I’ve been using R for 15 years, developing a package has been the one thing slightly out of reach for me. Now that I’ve been through the process once, with a package that’s not completely done (but at least has a firm foundation, and is usable to some degree), I can give you some advice:
- Make sure you know R Markdown before you begin.
- Some experience with Git and Github will be useful. Lots of experience will be very, very useful.
- Write the functions that will go into your package into a file that you can source into another R program and use. If your programs work when you run the code this way, you will have averted many problems early.
The process I used to make this happen was:
- I refactored ~250 lines of code into 15 lines of code and 12 functions. I stored the functions here: https://github.com/NicoleRadziwill/R-Functions/blob/master/MTSpak.R
- I followed this process:
- I created an example that will become a vignette soon: https://qualityandinnovation.com/2019/10/13/easymts-r-package-quick-solver-for-mahalanobis-taguchi-system-mts-problems/
I hope you enjoy following along with my process, and that it helps you write packages too. If I can do it, so can you!