title: higher level functions in R - is there an official compose operator or curry function?
body: <p>I can create a compose operator in R:</p>
  
  <pre><code> `%c%` = function(x,y)function(...)x(y(...)) 
  </code></pre>
  
  <p>To be used like this:</p>
  
  <pre><code> &gt; numericNull = is.null %c% numeric
   &gt; numericNull(myVec)
   [2] TRUE FALSE
  </code></pre>
  
  <p>but I would like to know if there is an official set of functions to do this kind of thing and other operations such as currying in R.  Largely this is to reduce the number of brackets, function keywords etc in my code.</p>
  
  <p>My curry function:</p>
  
  <pre><code>&gt; curry=function(...){
      z1=z0=substitute(...);z1[1]=call("list");
      function(...){do.call(as.character(z0[[1]]),
                            as.list(c(eval(z1),list(...))))}}
  &gt; p = curry(paste(collapse=""))
  &gt; p(letters[1:10])
  [1] "abcdefghij"
  </code></pre>
  
  <p>This is especially nice for e.g. aggregate:</p>
  
  <pre><code>&gt; df = data.frame(l=sample(1:3,10,rep=TRUE), t=letters[1:10])
  &gt; aggregate(df$t,df["l"],curry(paste(collapse="")) %c% toupper)
    l    x
  1 1  ADG
  2 2  BCH
  3 3 EFIJ
  </code></pre>
  
  <p>Which I find much more elegant and editable than:</p>
  
  <pre><code>&gt; aggregate(df$t, df["l"], function(x)paste(collapse="",toupper(x)))
    l    x
  1 1  ADG
  2 2  BCH
  3 3 EFIJ
  </code></pre>
  
  <p>Basically I want to know - has this already been done for R?</p>