You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a shiny app that begins with a series of instructions that are conditional on the input that a user selects. I want to include both text and a local image as part of the instructions. renderUI seems to be unable to locate the local image. include_graphics displays the image as expected, but I can not make it conditional on the input that the user selects.
---
title: "MyApp"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Sidebar {.sidebar}
=====================================
```{r}
selectInput("input_type",
label = "Select an input",
choices = list(" "=1,
"Input 1" = 2,
"Input 2" = 3))
```
MyApp
=====================================
Row {.tabset}
-----------------------------------------------------------------------
### img src
```{r}
renderUI({
input_type <- input$input_type
if (input_type == 1) {
HTML('Welcome to my app! Here are some instructions about how to use it.
A helpful image will appear when you select an input.')}
else if (input_type == 2) {
HTML('Here are some instructions.
<div><img src = "Posit_1.png"></div>')
}
else if (input_type == 3) {
HTML('Here are some other instructions.
<div><img src = "RStudio_2.png"></div>')
}
})
```
### include_graphics
```{r}
knitr::include_graphics("Posit_1.png")
knitr::include_graphics("Rstudio_2.png")
```
The text was updated successfully, but these errors were encountered:
I have a shiny app that begins with a series of instructions that are conditional on the input that a user selects. I want to include both text and a local image as part of the instructions.
renderUI
seems to be unable to locate the local image.include_graphics
displays the image as expected, but I can not make it conditional on the input that the user selects.The text was updated successfully, but these errors were encountered: