From the course: Building Data Apps with R and Shiny: Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Inserting images into Shiny apps
From the course: Building Data Apps with R and Shiny: Essential Training
Inserting images into Shiny apps
- [Instructor] Let's take a look at how to insert images into our Shiny apps. To do that, we're going to go to our exercises, folder 09_02, and we're going to open our Rstudio project. I'm going to need both the server.R file and the ui.R file. And now I've opened both those files, let's run the app to see what we're dealing with. So, we can see there are three different approaches to inserting images into our Shiny apps. Two out of three of those methods require our images to be inside the ww folder, and that's why we're not seeing the image on the first and second tab. So, let's go through these tabs in turn. The first tab uses the image function. Let's look at that in the ui.R file. So, in the ui.R file, if we scroll down to lines 15 through 16 we can see we're using the image function from the Shiny package, we're specifying the source argument as the path to our image, and we're specifying also the width of the image. Let's go back to the Shiny app, and our second tab is where we…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.