0

Looking for some specific help with Crosstalk without use of Shiny. Two things; First is get a slider select with one value instead of a range. Second is how to extract a selection from a filter_ object as a output variable. Below is some code for you to try. I want to take the value from the user selection and use it in another process. This value is not in the original table so not filterable as such. It is used calculated dynamically based on what the user selects. so if they select 0.002 I need to grab that as a variable.

library(crosstalk)

band<-data.frame(seq(0.001,0.5,0.001))

colnames(band)<-c("width")

bd<-SharedData$new(band)

bscols(
    filter_slider(
    id="Bandwidth",
    label="3.) Select a heat map bandwidth",
    step=0.001,
    sharedData= bd,
    column=~width,
    min=0.0010, max=0.0500) 
)

Any thoughts? Happy to provide more detail if required.

user2554330
  • 37,248
  • 4
  • 43
  • 90
  • 1
    If you're not using Shiny, there's no R running when you display the slider. It's just a web page with lots of Javascript. There might be a way to communicate with the browser to read the value of the slider (e.g. probably RSelenium could do it), but it's not the way this stuff is designed to work. – user2554330 Jan 31 '22 at 19:51
  • 1
    Regarding your first question: I don't think `filter_slider` can do that, you'd need to write your own control (which would be very similar). With `dragRange = TRUE` you can move a range, but I don't see a way to initialize it to a single point that is kept as a point. – user2554330 Jan 31 '22 at 20:18

0 Answers0