« How to Choose an R-Trainer? | Main | Agent Based Models and RNetLogo »

July 23, 2014


Feed You can follow this conversation by subscribing to the comment feed for this post.

R isn't a functional programming language. It may have functions but that doesn't make it a functional language, in the technical sense of that term.

This is an interesting package. For me (self styled intermediate R user without substantial knowledge of other programming languages), however, there would seem to be a large investment necessary to wrap my head around the fact that the order of functions is reversed. In the original code the code is written as Filter10, Summarize, Group, FilterNA; in the %>% version we have FilterNA, Group, Summarize, Filter10.

@Hefferman, well R is not pure functional, but mixed-paradigm. It certainly has functional elements; in particular functions are first-class objects in R.

@Nate I'd say the "regular" code is reversed, as the pipe (%>%) aligns code with the order of execution.

hourly_delay <- filter(summarise(group_by(filter(flights,
                                 delay = mean(dep_delay),
                                 n = n()),
                       n > 10)

This has the same power as extension methods in C#, allowing a fluent syntax. This style of programming really works in practice. Respect to the authors of this package!

The comments to this entry are closed.

Search Revolutions Blog

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr