how to use nest() in tidyr to collapse several rows
<p>I have a data frame like this</p>

<pre><code>df=data.frame(a=rep(c("x","y"),2),b=c("Rome", "Venice", "Barcelona", "Paris"))
</code></pre>

<p>and i want to nest b by column a such that it shows</p>

<pre><code>x  Rome, Barcelona
y  Venice, Paris
</code></pre>

<p>however this doesn't seem to do the trick. any advice?</p>

<p>As suggested </p>

<pre><code>df$b=as.character(df$b)
df=as.data.frame(df %&gt;% group_by(a) %&gt;% nest(b))
</code></pre>

<p>however the new data column of df seem to be in tbl_df format and result is like this</p>

<pre><code>a  data
x  list(b = c("Rome", "Barcelona")
</code></pre>

<p>is there a way to make the new nested column just normal string combinations?</p>