I'm making a shiny-app that takes data from a google sheets doc in google drive. In the MWE below, it just presents the table.
I want the app to present the current state of the google sheet, so I added invalidateLater to the reactive expression reading the data from google drive.
The downside is that the table refreshes as well every time, even if the data haven't changed. Any idea how to deal with that?
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)
server.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())
}
global.R
library(shiny)
library(knitr)
library(googlesheets)
muntgeg<-gs_title("RA-Munten")