Recently Dirk Eddelbuettel pointed out that our R
function debugging wrappers would be more convenient if they were available in a low-dependency micro package dedicated to little else. Dirk is a very smart person, and like most R
users we are deeply in his debt; so we (Nina Zumel and myself) listened and immediately moved the wrappers into a new micro-package: wrapr
.
Image: Friedensreich Hundertwasser
wrapr
is a deliberately limited package. It does two things:
- It supplies
R
argument capture function debug wrappers (previously distributed inWVPlots
andreplyr
). We have a short introduction here. We have also snuck in some improvements in how results are written back (detailed in the vignette). - It supplies the “
let
” execution macro (previously distributed inreplyr
). “let
” wraps convenient “non-standard name capture” interfaces into easier to program over “standard or parametric interfaces.” We have a short introduction here.
Future versions of replyr
and WVPlots
will re-export these functions. This means going forward there will be only one version of these functions, yet older code written against them should continue to work (in particular: all of our previous writing and videos demonstrating the methods).
Both of the wrapr
techniques (let
-wrapping and debug-wrapping) are quite powerful and can greatly speed up your ability to write and debug R
code. Please give these methods a try, and also please tell others about the wrapr
package.
Categories: Administrativia
jmount
Data Scientist and trainer at Win Vector LLC. One of the authors of Practical Data Science with R.
Note: the development versions of
replyr
andWVPlots
are now patched to re-export the wrapper functions fromwrapr
. I will push them to CRAN this month.And a huge thank you to Dirk for both his advice and support.
.
Debugging is very similar in function to the errorizer package. How does it differ?
https://cran.r-project.org/web/packages/errorizer/index.html
Honest answer is: I had not heard of
errorizer
, but as you say the functionality looks similar (as we are using similarR
tools). First look it appearserrorizer
does much more with function arguments.It looks like
errorizer
was first on CRAN 2016-11-06 and first on Github Nov 3, 2016. Thewrapr
debug functions were first on CRAN 2017-01-17 (in the packageWVPlots
) and had been public on Github since Apr 8 2016 (again in the package WVPlots as DebugPlot) with a public video on Apr 9 2016, and blog post about the technique at that time. The wrapping operator idea was from Nassim Haddad on Apr 11 2016. Though obviously theerrorizer
function may have been another one of your public packages earlier.I am assuming independent invention, especially as we treat function arguments differently.
In both cases the debug functionality rehashes some of the capabilities of
dump.frames
(though there are differences).Good choice to break it out into it’s own package.
It’s quite funny I wrote something very similar to wrapr::DebugFnW in 2012 but couldn’t open source it since it’s my employers code :(