'display.mode = 'showcase' in shinyApp() call - no code shown

I would like to be able to use display.mode = 'showcase' in an app run with the shinyApp() function call. According to the docs I should be able to pass any arguments that go runApp() through the options argument. The showcase mode works (the window is split) but it does not show the code. What's interesting is that if I run runExample("01_hello") everything works fine. I'm using shiny 1.0.5.

Code:

library(shiny)

ui <- fluidPage(

  titlePanel("Sample App"),

  sidebarLayout(
    sidebarPanel(
      selectInput("data", label = "Data set",
                  choices = c("mtcars", "iris"))
    ),

    mainPanel(
      tableOutput("table")
    )
  )
)

server <- function(input, output) {

  data <- reactive({
    get(input$data, 'package:datasets')
  })

  output$table <- renderTable({
    head(data())
  })

}

shinyApp(ui, server, options = list(display.mode = 'showcase'))

Output: shinyApp() with showcase mode not showing code



Solution 1:[1]

I was having the same issue. I had the app.R file and created the DESCRIPTION file using notepad but couldn't deploy a shinyApp with the code. Then I copied the DESCRIPTION file from shiny\examples\01_hello and noticed this:

enter image description here

Turns out my file had a TXT extension, so Shiny wasn't reading it as a metadata file. Once I used the correct DESCRIPTION file (which you can edit using notepad), everything worked out fine.

Solution 2:[2]

This is more of an addendum to Gus_est's answer, since I had the same problem and wasn't able to get it run right from there.

Create a file inside the directory your app.R-file resides in, e.g. a txt-file. Write into the file what display mode is to be used using Debian Control file format. In our case it would look like that (Title is not necessary):

Title: My App
DisplayMode: Showcase

Then rename the file DESCRIPTION without providing a file ending. Ignore the warning.

When you run the app now, it will always be in display mode "showcase", you can override this only inside the runApp()-statement. So I find the documentation to be misleading.

Solution 3:[3]

Check your current working directory. This problem seems to occur, if the working directory is not set to the folder with the app code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ogustavo
Solution 2 Humpelstielzchen
Solution 3 Samuel Liew