I would like to learn about unit/automated tests while writing functions/putting together scripts that perform a series of tasks. I am not a beginner but I have not been able to find decent resources online about that ("unit tests from scratch") ; every one that I found assumes you already know what it is and how to use it.
This probably ties to general guidelines about writing packages. What I found is that there are great resources out there on how to write a package from scratch (from Jenny Bryan et al.), but I had to figure out on my own what to do when I have my own script (that does a series of things in a linear fashion) that I want to turn into a package (which to be honest is probably the most common case among R users - I think there are very few entry-level users who start a project/task/analysis from writing a package).
Somehow the conceptual leap that a package is a series of functions so you have to break down your script into a series of functions was not explicit in online resources, and even after one figures this one out, how do you deal with the fact that your script is a linear progression of analytical steps but a package is a collection of independent functions?
So I think a short explanation/demo/tutorial on: "here is my R script that does ABC, and here is how to turn it into a package" would be very helpful.
And thank you for the great resource so far, keep up the good work :-)
Hi Ted,
I would like to learn about unit/automated tests while writing functions/putting together scripts that perform a series of tasks. I am not a beginner but I have not been able to find decent resources online about that ("unit tests from scratch") ; every one that I found assumes you already know what it is and how to use it.
This probably ties to general guidelines about writing packages. What I found is that there are great resources out there on how to write a package from scratch (from Jenny Bryan et al.), but I had to figure out on my own what to do when I have my own script (that does a series of things in a linear fashion) that I want to turn into a package (which to be honest is probably the most common case among R users - I think there are very few entry-level users who start a project/task/analysis from writing a package).
Somehow the conceptual leap that a package is a series of functions so you have to break down your script into a series of functions was not explicit in online resources, and even after one figures this one out, how do you deal with the fact that your script is a linear progression of analytical steps but a package is a collection of independent functions?
So I think a short explanation/demo/tutorial on: "here is my R script that does ABC, and here is how to turn it into a package" would be very helpful.
And thank you for the great resource so far, keep up the good work :-)