I'd like to be able to
- Plot a line chart in ggvis
- Add two interactive controls, which allow me to set the min and max x values on the chart
This sounds pretty straightforward - my code is:
minx = minx = input_numeric(1, 'Min x-val')
maxx = input_numeric(1, 'Max x-val')
data.frame(train.dt) %>%
ggvis(x = ~plot_idx, y = ~val) %>%
layer_lines() %>% add_axis('x') %>%
scale_numeric('x', domain = c(minx, maxx), clamp = T)
However, this doesn't work. I get this error message:
"Error in r[i1] - r[-length(r):-(length(r) - lag + 1L)] : non-numeric argument to binary operator".
If I replace minx and maxx in the domain argument with e.g. 1 and 10, my graph plots just fine (but is static). Any ideas?
Thanks!