r - 交互式 ggPredict whitin R Shiny FlexDashboard
问题描述
我正在使用 Flexdashboard 创建一个 R Shiny App;对于我正在使用ggiraphExtra包中的 ggPredict() 的图表
这是我需要使用 mtcars 数据集进行线性回归的以下图块:
### Graph2
```{r}
renderPlot({
Reg_LM <- lm(mpg ~ disp + hp, data = mtcars)
ggPredict(Reg_LM, interactive = F)
})
```
当我使用interactive = F运行我的 ggPredict 时,我的情节运行完美!
但是当我添加interactive = T(以获得更好的体验)时,我的情节就消失了(不返回任何错误消息)
我的猜测是 R Shiny 不支持来自 ggPredict 的interactive = T。可能是这样吗?或者 FlexDashboard 需要另一种方式来处理这个问题?
谢谢!
解决方案
谢谢@RyanMorton
这是完美运行的代码:
### Graph2
```{r}
output$plot5 <- renderggiraph({
ggiraph(code = print(ggPredict(lm(mpg ~ disp + hp + drat, data = mtcars),
colorAsFactor = T,
point = F)))
})
ggiraphOutput("plot5")
```
推荐阅读
- java - 如何更改按钮大小以不占用整个框架?
- java - 为什么我添加字符时会得到一个数字?
- rust - 返回值的 Rust 生命周期问题
- tomcat - WSO2IS 5.3.0 - 升级 tomcat jar
- opengl - SDL 中的静态流和目标纹理有什么区别?
- java - 如何使所有 cookie(甚至非 JSESSIONID cookie)成为“仅限 http”?
- android - Android Studio 拒绝连接到 React Native Server
- php - 以返回查询字符串结束的长 PHP 响应
- javascript - 使用可拖动 Javascript 时获取前一个元素的 ID
- winforms - Syncfusion v17 Winforms TreeView 控件有奇怪的行为