title: creating new variables with transform and %>%
body: <p>I'm trying to use the "pipe-like" operator to create a new variable, the same length as others in the dataframe, based on the <code>LETTERS</code> vector. Something is going wrong, and I am too new to <code>magrittr</code> to diagnose the problem.</p>
  
  <p>I am able to create the variable correctly when I try with some "traditional" nested functions:</p>
  
  <pre><code>expand.grid(a=c(1000-500,1000,1000+500),
                         b=c(15,150)) %&gt;%
    mutate(c=paste("foo", LETTERS[seq_along(a)],sep="_"))
  
  ##      a   b     c
  ## 1  500  15 foo_A
  ## 2 1000  15 foo_B
  ## 3 1500  15 foo_C
  ## 4  500 150 foo_D
  ## 5 1000 150 foo_E
  ## 6 1500 150 foo_F
  </code></pre>
  
  <p>So then I thought I'd try with the pipelike <code>%&gt;%</code> from <code>magrittr</code> and <code>dplyr</code></p>
  
  <pre><code>expand.grid(a=c(1000-500,1000,1000+500),
                         b=c(15,150)) %&gt;%
    mutate(c=paste("foo", a %&gt;% 
                     seq_along %&gt;% 
                     LETTERS[.],sep="_"))
  
  ## Error: incorrect number of dimensions
  </code></pre>
  
  <p>This also does not work when I add the aliased extract (<code>[</code>) function from <code>magrittr</code>:</p>
  
  <pre><code>expand.grid(a=c(1000-500,1000,1000+500),
                         b=c(15,150)) %&gt;%
    mutate(c=paste("foo", a %&gt;% 
                     seq_along %&gt;% 
                     extract(LETTERS,.),
                   sep="_"))
  
  ## Error: incorrect number of dimensions
  </code></pre>
  
  <p>I've tried debugging the pipe with <code>debug_pipe</code> to no avail.  I'd be very grateful for any ideas!</p>