Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

shiny

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

like image 317
Mikolaj Avatar asked Nov 11 '17 17:11

Mikolaj


1 Answers

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.

like image 57
ogustavo Avatar answered Oct 25 '22 11:10

ogustavo