簡體   English   中英

R-markdown中對ggvis的無功輸入導致退出

[英]Reactive input to ggvis in R-markdown cause quit

我正在嘗試使用帶有光澤的R-markdown進行一些交互式可視化。 該文件允許用戶指定一堆數據文件,並使用反應性閃亮表達式來獲取已處理的數據幀data() 我可以將data()renderPlot一起使用,以正確繪制一堆圖(例如heatmap.2plot )。 但是,當我嘗試使用ggvis繪制反應性數據時,html的生成總是在ggvis代碼塊中退出。 我嘗試了答案如何將數據從反應性Shiny表達式傳遞到ggvis圖? 但是答案中的兩種方法都導致“從行中退出”。 這是我的代碼:

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

ggvisOutput("plot1")

這是基於其他方法的代碼:

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

我正在使用R-Studio版本0.99.441,R版本3.2.1(2015-06-18),shiny_0.12.1,ggvis 0.4。

改用純Shiny並重試此方法,而不是使用reactive ,而是將整個程序包裝在observe 這很完美。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM