mutate_each on tidyr nested table gives "Unknown inputs"
<p>I am trying to do a <code>mutate_each</code> using <code>purr::map</code> on a group of tables created by <code>tidyr::nest</code>.</p>

<p>Below is an example of what I am trying to do and the resulting error:</p>

<pre><code>library(tidyr)
library(gapminder)
library(dplyr)
library(purrr)


by_country &lt;- gapminder %&gt;% 
  group_by(continent, country) %&gt;% 
  nest() %&gt;% 
  mutate(data2 = map(data,  ~ mutate_each(.,funs(as.numeric))))
</code></pre>

<p>gives:</p>

<p><code>Error: Unknown inputs</code></p>

<p>What is causing this problem? Is there a fix? I could use <code>apply</code> instead of <code>mutate_each</code> but that removes rownames.</p>

<p><strong>EDIT:</strong> From the first response it seems the purpose was not clear. So perhaps I am trying to do something the wrong way. Let me explain.</p>

<p>If you do:</p>

<pre><code>by_country &lt;- gapminder %&gt;% 
   group_by(continent, country) %&gt;% 
   nest()
</code></pre>

<p>You have:</p>

<pre><code>by_country$data[[1]]
Source: local data frame [12 x 4]

    year lifeExp      pop gdpPercap
   (int)   (dbl)    (int)     (dbl)
1   1952  28.801  8425333  779.4453
2   1957  30.332  9240934  820.8530
3   1962  31.997 10267083  853.1007
4   1967  34.020 11537966  836.1971
5   1972  36.088 13079460  739.9811
6   1977  38.438 14880372  786.1134
7   1982  39.854 12881816  978.0114
8   1987  40.822 13867957  852.3959
9   1992  41.674 16317921  649.3414
10  1997  41.763 22227415  635.3414
11  2002  42.129 25268405  726.7341
12  2007  43.828 31889923  974.5803
</code></pre>

<p>What I would like is run a function for each column; but done separately for each nested table. So I would like to run the equevalent of the below on each table:</p>

<pre><code>mutate_each(by_country$data[[1]],funs(as.numeric))
</code></pre>

<p>Giving:</p>

<pre><code>Source: local data frame [12 x 4]

    year lifeExp      pop gdpPercap
   (dbl)   (dbl)    (dbl)     (dbl)
1   1952  28.801  8425333  779.4453
2   1957  30.332  9240934  820.8530
3   1962  31.997 10267083  853.1007
4   1967  34.020 11537966  836.1971
5   1972  36.088 13079460  739.9811
6   1977  38.438 14880372  786.1134
7   1982  39.854 12881816  978.0114
8   1987  40.822 13867957  852.3959
9   1992  41.674 16317921  649.3414
10  1997  41.763 22227415  635.3414
11  2002  42.129 25268405  726.7341
12  2007  43.828 31889923  974.5803
</code></pre>