I have a shiny app which works just fine. Now, I want to display a static image as a logo on top of the page. Problem is the logo does not show up when I run the app, it just shows a missing file icon..
Top of my ui function looks like this:
ui = fluidPage(
img(heigth = 100, width = 100, src = "logo.png", align = "right"),
pageWithSidebar(
headerPanel(title = "ABC", windowTitle = "ABC"),
sidebarPanel(...
I run the app as follows:
# --------------------------------------------------------------------------------------------------------------------------------------
# Settings:
dir = "C:/app/";
folder_code = "r/";
# --------------------------------------------------------------------------------------------------------------------------------------
# Main:
# Libraries:
library(shiny);
library(plotly);
# Includes:
source(file=paste(dir, folder_code, "analysis.r", sep=""));
source(file=paste(dir, folder_code, "plotlib.r", sep=""));
source(file=paste(dir, folder_code, "ui.r", sep=""));
source(file=paste(dir, folder_code, "server.r", sep=""));
# Run app:
shinyApp(ui = ui, server = server, options=list(launch.browser = TRUE))
The directory where the app code and image is placed looks like this:
|r
|www [<- my image is stored in this folder]
analysis.r
app.r
ui.r
server.r
plotlib.r
EDIT: With the following changes, it now works:
I create a file app.R with just this line of code:
app = shinyApp(ui = ui, server = server)In my main code displayed above, I replace
shinyApp(...)
by
shinyAppFile(appFile = paste(dir, folder_code, "app.r", sep=""),
options=list(launch.browser = TRUE))
No clue however why it works like that and not as I had it previously..
img(heigth = 100, width = 100, src = "www/logo.png", align = "right")? Your ui.r is looking for logo.png in the same directory as it is, but the logo is in another folder (www)... - jkrainer