【发布时间】:2017-02-11 13:37:53
【问题描述】:
我正在制作一个闪亮的应用程序,它从谷歌驱动器中的谷歌表格文档中获取数据。在下面的 MWE 中,它只显示表格。
我希望应用程序呈现 google 表格的当前状态,因此我将 invalidateLater 添加到从 google drive 读取数据的反应式表达式中。
缺点是表格每次都会刷新,即使数据没有改变。知道如何处理吗?
MWE:
ui.R
library(shiny)
library(shinydashboard)
header <- dashboardHeader(title = "Title")
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("All", tabName = "All", icon = icon("fa fa-circle")
)
)
)
body <- dashboardBody(
tabItems(
tabItem(tabName = "All",
fluidRow( box(width=12,title="Table",
solidHeader = TRUE,status = "primary",
dataTableOutput(outputId="Munt")
#plotOutput(outputID="Munt")
)
)
)
))
ui <- dashboardPage(header, sidebar,body)
服务器.R
server<-function(input,output,session){
session$onSessionEnded(function() {
stopApp()
})
DF<-reactive({
invalidateLater(60000,session=session)
temp<-gs_read(muntgeg)
temp})
output$Munt<-renderDataTable(DF())
}
全球.R
library(shiny)
library(knitr)
library(googlesheets)
muntgeg<-gs_title("RA-Munten")
【问题讨论】: