We’ve been getting some good uptake on our piping in
R article announcement.
The article is necessarily a bit technical. But one of its key points comes from the observation that piping into names is a special opportunity to give general objects the following personality quiz: “If you were an
R function, what function would you be?”
Continue reading “If You Were an R Function, What Function Would You Be?”
We forgot to say: R Journal Volume 10/2, December 2018 is out!
A huge thanks to the editors who work very hard to make this possible.
And big “thank you” to the editors, referees, and journal for helping improve, and for including our note on pipes in
Recently Hadley Wickham prescribed pronouncing the
magrittr pipe as “then” and using right-assignment as follows:
I am not sure if it is a good or bad idea. But let’s play with it a bit, and perhaps readers can submit their experience and opinions in the comments section.
Continue reading Playing With Pipe Notations
Composing functions and sequencing operations are core programming concepts.
Some notable realizations of sequencing or pipelining operations include:
The idea is: many important calculations can be considered as a sequence of transforms applied to a data set. Each step may be a function taking many arguments. It is often the case that only one of each function’s arguments is primary, and the rest are parameters. For data science applications this is particularly common, so having convenient pipeline notation can be a plus. An example of a non-trivial data processing pipeline can be found here.
In this note we will discuss the advanced
R pipeline operator "dot arrow pipe" and an
S4 class (
wrapr::UnaryFn) that makes working with pipeline notation much more powerful and much easier.
Continue reading Function Objects and Pipelines in R
R Tip: use inline operators for legibility.
Python feature I miss when working in
R is the convenience of
+ operator. In
+ does the right thing for some built in data types:
- It concatenates lists:
[1,2] +  is
[1, 2, 3].
- It concatenates strings:
'a' + 'b' is
And, of course, it adds numbers:
1 + 2 is
The inline notation is very convenient and legible. In this note we will show how to use a related notation
Continue reading R Tip: Use Inline Operators For Legibility
In our last note we used
wrapr::qe() to help quote expressions. In this note we will discuss quoting and code-capturing interfaces (interfaces that capture user source code) a bit more.
Continue reading Quoting Concatenate
R are popular, the most popular one being
magrittr as used by
This note will discuss the advanced re-usable piping systems:
rqdatatable operator trees and
wrapr function object pipelines. In each case we have a set of objects designed to extract extra power from the
wrapr dot-arrow pipe
Continue reading Reusable Pipelines in R
Reusable modeling pipelines are a practical idea that gets re-developed many times in many contexts.
wrapr supplies a particularly powerful pipeline notation, and a pipe-stage re-use system (notes here). We will demonstrate this with the
vtreat data preparation system.
Continue reading Sharing Modeling Pipelines in R
R users appear to be big fans of "code capturing" or "non standard evaluation" (NSE) interfaces. In this note we will discuss quoting and non-quoting interfaces in
Continue reading Quoting in R
coalesce is a classic useful
SQL operator that picks the first non-
NULL value in a sequence of values.
We thought we would share a nice version of it for picking non-
NA R with convenient operator infix notation
wrapr::coalesce(). Here is a short example of it in action:
NA %?% 0
#  0
A more substantial application is the following.
Continue reading coalesce with wrapr