2

I'm trying to use R-markdown with shiny to do some interactive visualization. The file let the user specify a bunch of data files and use reactive shiny expression to get a processed dataframe, data(). I can use data() with renderPlot to correctly plot out a bunch of graphs(like heatmap.2, plot). However, when I try using ggvis to plot the reactive data, the generation of the html always quit at the ggvis code chunk. I tried the answer to How is data passed from reactive Shiny expression to ggvis plot?. But both of the two methods in the answer led to "Quitting from lines". Here's my code:

reactive({
    data %>% ggvis(~pcomp, ~variances) %>% 
    layer_points()%>%
    layer_bars(fill := "gray", opacity := 0.5) %>%
    layer_lines()
}) %>% bind_shiny("plot1")

ggvisOutput("plot1")

Here's my code based on the other method:

data %>% ggvis(~pcomp, ~variances) %>% 
    layer_points()%>%
    layer_bars(fill := "gray", opacity := 0.5) %>%
    layer_lines()

I'm using R-Studio Version 0.99.441, R version 3.2.1 (2015-06-18), shiny_0.12.1, ggvis 0.4.

Community
  • 1
  • 1
Qin Zhu
  • 331
  • 1
  • 2
  • 11

1 Answers1

0

Switched to pure Shiny and retried this, instead of using reactive, I wrapped the whole thing in observe. This works perfectly.

Qin Zhu
  • 331
  • 1
  • 2
  • 11