闪亮的应用程序在本地计算机上运行,​​部署时失败

时间:2015-04-05 16:13:54

标签: r shiny

我已成功使用linode部署了几个Shiny应用程序。以下应用程序在本地运行。部署的应用程序按预期加载,但是当“Run,Daphne!”时按下按钮,应用程序灰显。我不认为这是一个包的问题,​​但任何帮助将不胜感激。

# ui.R
shinyUI(
  mainPanel(
    selectInput("select", label = h3("Select Restaurant "), 
                choices = list("Taco Bell", "Burger King", "McDonalds",  "Wendys", "Dominos", "Olive Garden"), 
                selected = 1),
    actionButton("goButton", "Run, Daphne!"),
    p("Click the button, then Daphne will run from Tokyo to Paris"),
    textOutput("nText")
  )
)


# server.R
shinyServer(function(input, output) {
  calories.Data <<- read.csv("DATA/reallyFastCalories.csv")

  # builds a reactive expression that only invalidates 
  # when the value of input$goButton becomes out of date 
  # (i.e., when the button is pressed)
  ntext <- eventReactive(input$goButton, {
    building <<- "Daphne Millbrook ran 6,045 miles. To account for burning 713,310 calories, she ate a substantial amount of food from "
    building <<- paste(building, input$select, sep = '')
    building <<- paste(building, ". Her order was as follows : ", sep = '')
    sub.Data <<- calories.Data[ which(calories.Data$Shop == input$select), ]
    calorie.count <<- 0
    order.count <<- vector()
    order.count[1:length(sub.Data$Shop)] <<- 0
    order.vector <<- vector()
    while(calorie.count < 713310){
      step.gen <<- sample(1:length(sub.Data$Shop),1)
      order.count[step.gen] <<- order.count[step.gen] + 1
      calorie.count <<- calorie.count + as.numeric(sub.Data$Calories[step.gen])
    }
    word.pieces <<- 0
    for(i in 1:length(sub.Data$Shop)){
      if(order.count[i] > 0){
        order.vector[word.pieces] <<- paste(order.count[i], "x ", sub.Data$Item[i], ", ", sep = '')
        word.pieces <<- word.pieces + 1
      }
    }
    building <<- c(building, sample(order.vector), sep = '') # sample() to evade obvious boring alphabetical order
    return(c(building, "and a whole lot of water!", sep = ''))
  })

  output$nText <- renderText({
    ntext()
  })
})

0 个答案:

没有答案