r - 如何在rmarkdown中使用输入框和动作按钮输出本地图形
问题描述
我是 rmarkdown 新手,现在我想创建一个具有以下功能的 rmarkdown 网站:
有一个selectInput框和一个或多个actionbutton(这里只有一个)
我想在选择一个输入时输出本地数字。
但我不知道我的代码块哪里出了问题。
这是我的可重现代码:
---
title: "123"
output:
flexdashboard::flex_dashboard:
orientation: columns
social: menu
source_code: embed
runtime: shiny
editor_options:
chunk_output_type: inline
---
```{r setup, include=FALSE}
library(flexdashboard)
```
abc {.sidebar }
=========================================================
<h4>Search with mouse gene symbol, the results will be displayed beside:</h4>
<style>
.shiny-flow-layout>div {
width: 100%;
}
</style>
```{r}
#knitr::opts_chunk$set()
library(rmarkdown)
inputPanel(
selectizeInput(
"selectGeneSymbol",
"what selected:",
choices = "Slc2a1",
multiple =F,
width = 360,
selected = "Sele"
)
)
actionButton(inputId = "plot1", label = "plot1")
```
Home {.tabset}
===================================
```{r ,warning = FALSE, message = FALSE,echo=FALSE,fig.height= 6}
p1 <- eventReactive(input$plot1,
{
# ![unchanged image](Slc2a1_FPKM.png)
knitr::include_graphics(paste0(input$selectGeneSymbol,"_FPKM.png"))
})
renderPlot({
p1()
})
```
谢谢你的帮助。
解决方案
推荐阅读
- c - 能够在条件语句中时出现 C char 指针错误
- sql - 有没有办法以所需的格式加入这两个表?
- java - 如何将特定数据字段从 ArrayList 加载到某些 JTextFields?
- javascript - 如何获取对象属性列表数据
- android - 应用签名密钥证书与上传密钥证书相同
- azure-devops - Azure Terraform 函数应用部署问题
- python - 使用 lambda 函数进行多次替换 python
- loops - Mathematica 中的循环表达式
- html - VS Code - 图像文件路径参考不起作用
- android-studio-arctic-fox - 无法将项目作为库导入现有项目,android studio Arctic Fox