I am a new R Shiny user and have been tasked to put together an application that displays a datatable that requires automatic updates. Through my research I discovered and correctly applied the reactiveFileReader function such that when the data is overwritten the datatable shown in the application is updated. It works perfectly locally but when I publish to shinyapps.io the datatable no longer updates. Below is a super simple app that demonstrates this problem:
library(shiny)
ui <- fluidPage(
titlePanel("TitleApp"),
mainPanel(DT::dataTableOutput("df"))
)
server <- function(input, output, session) {
reactive_data <- reactiveFileReader(
intervalMillis = 1000,
session = session,
filePath = "testdata.csv",
readFunc = function(filePath) {
read.csv(filePath)
}
)
output$df <- DT::renderDataTable({
reactive_data()
})
}
shinyApp(ui, server)
The file "testdata.csv" is located in the working directory where the project, app, and rsconnect folder is located. The data is as follows:
A B
1 6
2 7
3 8
4 9
5 10
which updates to
A B
10 60
20 70
30 80
40 90
50 100
Any thoughts as to what the issue is?
If so, is there a better way to do this altogether?
Please let me know if there is anything else that can be made more clear.
Thank you.