rbokeh: saving selection to a new dataframe

In the following example:
figure() %>%
ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species) %>%
tool_box_select() %>%
tool_lasso_select()

(from R Interface for Bokeh • rbokeh)

How could I save selected points to a new dataframe?

Thanks

This can’t be done in a plain R session since the html file created does not have any communication with the R session. If you use this within a shiny app it is possible to get the index of selected points back, but it is very experimental at this time. An example of using rbokeh with shiny is here: https://github.com/bokeh/rbokeh/blob/master/man-roxygen/ex-shiny.R. This example doesn’t use selection callbacks but the idea is similar. Basically when you add your box select tool, you can specify a shiny callback with callback = shiny_callback(“selected_idx”) where there will now be a new shiny input called “selected_idx” that will be triggered when selections are made.

···

On Monday, June 26, 2017 at 2:00:39 AM UTC-6, Agustin Lobo wrote:

In the following example:
figure() %>%
ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species) %>%
tool_box_select() %>%
tool_lasso_select()

(from http://hafen.github.io/rbokeh/index.html#tools)

How could I save selected points to a new dataframe?

Thanks