ggvis是否与Shiny Documents合作?
在此示例中,ggplot可见,但ggvis不是
---
title: "testShiny"
runtime: shiny
output: html_document
---
ggplot2
```{r, echo=FALSE}
require(ggplot2)
renderPlot({
ggplot(women, aes(height, weight))+
geom_point()+
theme_bw()
})
```
ggvis
```{r, echo=FALSE}
require(ggvis)
renderPlot({
women %>%
ggvis(x= ~height, y = ~weight) %>%
layer_points()
})
```
在搜索时遇到了bind_shiny,但它没有解决问题
答案 0 :(得分:3)
您需要使用bind_shiny
为可视化分配ID。然后,您需要使用ggvisOutput
在DOM中创建一个元素来显示可视化:
---
title: "testShiny"
runtime: shiny
output: html_document
---
```{r, echo=FALSE}
require(ggvis)
require(knitr)
require(shiny)
ggvisOutput("p")
women %>%
ggvis(x= ~height, y = ~weight) %>%
layer_points()%>%
bind_shiny("p")
```