dplyr: access current group variable
<p>After using data.table for quite some time I now thought it's time to try dplyr. It's fun, but I wasn't able to figure out how to access 
- the current grouping variable
- returning multiple values per group</p>

<p>The following example shows is working fine with data.table. How would you write this with dplyr</p>

<pre><code>foo &lt;- matrix(c(1, 2, 3, 4), ncol = 2)
dt &lt;- data.table(a = c(1, 1, 2), b = c(4, 5, 6))

# data.table (expected)
dt[, .(c = foo[, a]), by = a]
   a c
1: 1 1
2: 1 2
3: 2 3
4: 2 4

# dplyr (?)
dt %&gt;% 
  group_by(a) %&gt;% 
  summarize(c = foo[a])
</code></pre>