I was just hoping to figure out how i can use handle_hover() or handle_click() to return a value outside of the environment of the visualization.
Ultimately i want to use this to return a key value so i can link two graphs onto a shiny application.
Using the example from the documentation, I have:
mtcars$id <- seq_len(nrow(mtcars))
hoveron<-function(data,...){
testval<<-str(data)
testval
}
mtcars %>% ggvis(~mpg, ~wt,key:=~id) %>% layer_points() %>%
handle_hover(hoveron)
This returns
'data.frame': 1 obs. of 3 variables:
$ id : int 16
$ mpg: num 10.4
$ wt : num 5.42"
In the console
What would i need to do in order to return testval= 16
Many thanks!