部署后没有显示闪亮的表

时间:2016-03-01 14:27:09

标签: r shiny-server shiny

我正在尝试在shinyapps上呈现数据表,但它没有显示。如果我在本地运行它会显示出来。我有4个脚本和1个数据文件,ui.R,server.R,helper1.R,helper2.R,DATA1.RDATA,

当我加载DATA1.RDATA时,它变为对象data

我还提供了两个辅助函数,它们将过滤data并返回一个df。服务器中的这一行假定调用辅助脚本中的函数并返回一个df并呈现数据表。

output$overview_table <- renderDataTable(o_table(data,input$overview_year_level2),options = list(searching = FALSE, paging = FALSE, searchable = FALSE))

ui.r

library(shiny)
library(markdown)

shinyUI(navbarPage("Title",
                   tabPanel("Overview",
                            sidebarLayout(
                              sidebarPanel(uiOutput("overview_year_level")),
                              mainPanel(
                                imageOutput("overview_volume_value_pie"),
                                p(),
                                dataTableOutput("overview_table")
                              )
                            ))))

server.R

library(shiny)
source("helper1.R")
source("helper2.R")
load("DATA1.RDATA")




shinyServer(function(input, output,session) {

  ### OVERVIEW TABLE ###

  output$overview_year_level <- renderUI({
      selectInput("overview_year_level2","Select Year",c("Select",'2015','2016'),
                                                   "Select")
    }
  )

  output$overview_table <- renderDataTable({o_table(data,input$overview_year_level2)},
      options = list(searching = FALSE, paging = FALSE, searchable = FALSE))

})

helper1.R

library(ggplot2)
library(ggthemes)
library(stringr)
library(dplyr)
library(DT)
library(scales)
library(RColorBrewer)
require(gridExtra)
library(scales)

q_o_channel <- function (df,year1) {

  data <- df %>%
        filter(year == year1) %>%
        group_by(chnl) %>%
        summarize(volume = sum(volume)
                  ,value = sum(value))

  return(data)
}

helper2.R

o_table <- function(data,year1) {
  df <- q_o_channel(data,year1)
  return(df)
}

1 个答案:

答案 0 :(得分:0)

<强>固定

我更新了Rshiny,问题已修复。