Hello, My approach is quite opposite to Luke's.
I mostly do exploratory "data analysis at an individual researcher/team level" precisely. I use knitr/R Markdown dynamic reports (think Jupyter notebooks, for all the Pythonistas out there). At this (exploratory) stage, I don't do testing per se. But I *need* to have some sanity checks along the way! So I have a few `expect_true()`, `expect_that()`, etc. (from the `testthat` package) here and there. It's not testing, it doesn't really cover much, but I need to be a little defensive so that I can trust what's being computed... I know that `testthat` is intended for unit testing but, you know, I live in the Hadleyverse. :) Cheers, Marianne On Fri, Sep 30, 2016 at 1:50 PM, Luke Johnston <[email protected]> wrote: > I agree with Naupaka that it is a bit advanced. However, the package > `testthat` is not for defensive programming per se, but for unit tests. For > defensive programming specifically there is the `assertive` and `assertr` > packages. However, unlike Python, the facilities for defensive programming > are not as well developed in R and are a bit unwieldy. Considering > programming is not often done in R for a larger user base but rather for > data analysis at a individual researcher/team level, I don't think it is > worthwhile to add too much/anything to the defensive programming for R. The > lessons are packed enough as it is. > > In addition to that, most people coming to the R workshops are looking to > learn about data and statistical analysis. Defensive programming is > something they would likely never use. I've used R for several years and > develop a few packages and even I very rarely use these defensive > facilities. > > Just my two cents. > > Luke > > > On 2016-09-30 12:52 PM, Naupaka Zimmerman wrote: > > Hi Raniere - > > I think it isn't a part of the materials because it's a bit advanced for the > usual audience level. But that's not to say it wouldn't be nice to have. I > imagine such a lesson could intro the base assertion functions like > stopifnot() and also Hadley's testthat package. PRs welcome! > > Best, > Naupaka > > On 30 Sep 2016, at 8:19, Raniere Silva wrote: > > Hi all, > on our Programming with Python, > http://swcarpentry.github.io/python-novice-inflammation/08-defensive/, > we have a "Defensive Programming" section. > This section is missing on the R lesson. > Any experience R instructor can let me know why? > And if you have your "translation" of that lesson in R > could you send me a copy of it? > Cheers, > Raniere > _______________________________________________ > Discuss mailing list > [email protected] > > http://lists.software-carpentry.org/listinfo/discuss > > > > _______________________________________________ > Discuss mailing list > [email protected] > http://lists.software-carpentry.org/listinfo/discuss > > > > _______________________________________________ > Discuss mailing list > [email protected] > http://lists.software-carpentry.org/listinfo/discuss _______________________________________________ Discuss mailing list [email protected] http://lists.software-carpentry.org/listinfo/discuss
