1

I'm trying my best to place a logo in my shiny app, but its showing blue question mark every time. I made a separate ui and server file as well but still didn't work. I also made a 'www' folder and set it as a working directly with image inside it, but no result. Can someone please guide me?

library(dplyr)

library(shiny)

library(shinythemes)

#UI
ui = fluidPage(img(src = "picture.jpg"), fluidRow( rpivotTableOutput("pivot")))


#Server
server = function(input, output, session) {reactive({
    mtcars %>% select(cyl, carb, vs, mpg) %>% group_by(carb,vs ) %>% summarise(mpg=sum(mpg))}) 

  output$pivot <- renderRpivotTable(  rpivotTable::rpivotTable(mtcars, rows = c( "vs"),cols=c("carb"), vals =  "mpg", aggregatorName = "Sum",                                rendererName =  "Table",                                                  width="50%", height="550px"))}

shinyApp(ui = ui, server = server) 
Sid
  • 53
  • 8
  • Where exactly does the `picture.jpg` file exist on disk? – MrFlick Oct 29 '18 at 20:51
  • Possible duplicate: https://stackoverflow.com/questions/21996887/embedding-image-in-shiny-app – MrFlick Oct 29 '18 at 20:52
  • It exists within 'www' on desktop – Sid Oct 29 '18 at 20:52
  • The "www" directory should not be the working directory. It should be *in* the working directory. So unless your working directory is your desktop, that's not the right place. – MrFlick Oct 29 '18 at 20:54
  • Thanks i read that an hour ago, but didn't help much – Sid Oct 29 '18 at 20:54
  • Possible duplicate: https://stackoverflow.com/questions/45404767/put-image-in-shiny-app – MrFlick Oct 29 '18 at 20:54
  • @MrFlick i did that just now, but still not working – Sid Oct 29 '18 at 20:58
  • Did you spell the file name correctly? There’s something going on that you are not telling us in your question because that should work. Try to include a proper reproducible example. – MrFlick Oct 29 '18 at 21:00
  • God knows, I have spent past 4 hours working on it, but no result – Sid Oct 29 '18 at 21:01
  • Hey mate, finally its working, i did't put my app.R file in the working directory which was having 'www' folder. Thanks a lot @MrFlick :) – Sid Oct 29 '18 at 21:07
  • Hey @MrFlick, the logo is working perfectly fine on local shiny, but when i deploy it to shinyapp.io, it shows a blank picture. Can you pls help me out again ? Thanks – Sid Oct 30 '18 at 07:07
  • See my answer at your follow-up question here https://stackoverflow.com/questions/53059211/logo-image-is-not-getting-displayed-on-shinyapps-io – Eli Berkow Oct 30 '18 at 14:56

0 Answers0