rstudio/ggvis — pull request #163 by saurfang (2014-05-26 21:12:59+00:00)
Title: Fix grouped_df in dynamic view

Redo the PR #155 because master got updated and I botched the upstream merge. Again this is to allow ggvis to work with `grouped_df` in dynamic view.

The root cause was that data for `grouped_df` are broken down to source data and a `flatten` data transform verb. The latter part must be included as part of the initial plot spec. So the naive fix could just be that we always materialize dataset when constructing the initial spec.

One of the concerns was that we would send dataset twice during the initialization phase because a `ggvis_data` message will also be sent during setup. So I made a separate logic just for `grouped_df` such that everything else continue just sending its name but `grouped_df` would include the additional `flatten` transform.

Not sure if this is the right trade between code complexity and performance.

Lastly, for this to work, we need to make sure when processing `ggvis_data` we use the correct dataset name for `grouped_df` in `shiny-ggvis.js`

Here's a simple example to reproduce:
```
view_dynamic(mtcars %>% ggvis(~wt, ~mpg) %>%
group_by(cyl) %>%
layer_paths())
```