简体   繁体   中英

R Shiny - numericInput label disappears once publishing

I'm writing a website that simply accepts numbers and uses the inputs to create a graph and a table. The program works perfectly when I run it locally on my computer, but once I publish it, the label for the third numeric input box disappears.

Here is my code:

library(shiny)
library(shinythemes)
library(tidyverse)

# Define UI for application 
ui <- fluidPage(theme = shinytheme("simplex"),

    # Application title
    titlePanel("Statistics"),

    # Sidebar with a numeric input for data
    sidebarLayout( 
      
      sidebarPanel("Enter Data Below:",
                   
                   numericInput(inputId = "ad1", label = "Approach Shot Distance 1:", value = 0, min = 0),
                   numericInput(inputId = "pd1", label = "Putt Length 1:", value = 0, min = 0),
                   numericInput(inputId = "ad2", label = "Approach Shot Distance 2:", value = 0, min = 0)
      ),  
      
      mainPanel( 
        tabsetPanel( 
          tabPanel("Graph", fluid = TRUE, 
                   textOutput(outputId = "greeting")), 
          tabPanel("Table", fluid = TRUE, 
                   textOutput(outputId = "farewell")))) 
      
    )) 

server <- function(input, output) {   
  #testers for now-- I will replace these with the graph and table outputs once I fix this issue
  output$greeting <- renderText({"Hello!"}) 
  output$farewell <- renderText({"Goodbye!"}) 
  
}  
shinyApp(ui=ui, server=server)  

Here is what I see when I run the app in R on my computer

Here is what it looks like when I publish the app with shinyapp.io

The third label shows fine both locally and when I deployed on shinyapps.io. I'd try re-deploying to a shiny server. Also, you can check shiny server logs and use something like Chrome's devtools to review the html/js when hosted remotely.

It could be a problem with a some browser caching -- try clearing your browser cache or use a new browser.

Maybe share the link of the deployed app to get more help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM