4

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)
)
Susan Switzer
  • 1,531
  • 8
  • 34
HClarkeLds
  • 43
  • 5
  • 1
    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) – Susan Switzer Apr 09 '20 at 17:03
  • @Susan Switzer, you can post that as an answer – Mr.Rlover Apr 09 '20 at 21:51

1 Answers1

2

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.

Susan Switzer
  • 1,531
  • 8
  • 34
  • 1
    It was definitely an issue with encoding of the space characters in my CSV not being recognised in UTF-8 - I found all the mystery spaces and replaced them with normal ones in Excel and this seemed to work :) Thank you for your input! – HClarkeLds Apr 11 '20 at 12:51