HClarkeLds
HClarkeLds

Reputation: 43

shiny Rmarkdown selectInput doesn't work when hosted on shinyapps.io - options contain <a0>

I've created an interactive Rmarkdown document that works perfectly well when hosted on my machine, however, when I publish it to shinyapps.io all of my select input options which relate to my datasets are no longer functional.

For example, this is one of my apps (below). Hosted locally one of my options would be "School Name A" from the select input menu. When I host this on shinyapps.io this comes up as "Schoola0Namea0A" and when I select it no longer renders the output. (but with < > around the a0)

shinyApp(
  ui = fluidPage( inputPanel(
      selectInput("schoolName", label = "show school",alloc$SCHNAME, multiple= FALSE, selectize = TRUE)),
      mainPanel(
        plotlyOutput("distPlot", height = 400, width = 750)
        )
      ),


  server =  function(input, output){

      selectedSchool <- reactive({ 
        subset(alloc, SCHNAME == input$schoolName)
      })

     output$distPlot <- renderPlotly({ggplot(aes(x = dist_combined), data = selectedSchool()) +
         geom_histogram(breaks = seq(0, 11, by = .5), fill = "#238A8DFF") +
         labs(x = "distance travelled to school (miles)", y = "count\n", title = paste0("\nDistances travelled to school at ", selectedSchool()$SCHNAME))+
         scale_x_continuous(breaks = c(1,2,3,4,5,6,7,8,9,10),limits = c(0,11)) +ylim(0,175)

     })
  },
  options = list(height = 550)
)

Upvotes: 4

Views: 185

Answers (1)

Susan Switzer
Susan Switzer

Reputation: 1922

I was able to resolve the same issue that you are experiencing by changing the encoding of the dataset that I was adding to my selectInput choices arguments. For some reason, the data was encoded as ASCII. I was able to implement the encoding change at the point of importing these data: read.csv(file = "pathtofile), fileEncoding = NULL) or just leave off the fileEncoding argument.

Upvotes: 2

Related Questions