Hacker News new | ask | show | jobs
by kkoncevicius 2015 days ago
All %fun% constructs are just simple functions that can be created by the user and can be used as infix operators. Base R has a few of those: %in%, %o%, %*%, %x%, %%, %/%.

magrittr created %>% which, when used in infix: x %>% f() calls the function on the right side with the argument on the left side f(x).

There are package that provide tons more. For example: https://github.com/moodymudskipper/inops . And you can easily create your own:

    `%sum%` <- function(x, y) x + y

    1 %sum% 2
    [1] 3