reactiveFileReader

0th

Percentile

Reactive file reader

Given a file path and read function, returns a reactive data source for the contents of the file.

Usage
reactiveFileReader(intervalMillis, session, filePath, readFunc, ...)
Details

reactiveFileReader works by periodically checking the file's last modified time; if it has changed, then the file is re-read and any reactive dependents are invalidated.

The intervalMillis, filePath, and readFunc functions will each be executed in a reactive context; therefore, they may read reactive values and reactive expressions.

Value

A reactive expression that returns the contents of the file, and automatically invalidates when the file changes on disk (as determined by last modified time).

See Also

reactivePoll

Aliases
Examples
# Per-session reactive file reader
shinyServer(function(input, output, session)) {
  fileData <- reactiveFileReader(1000, session, 'data.csv', read.csv)

  output$data <- renderTable({
    fileData()
  })
}

# Cross-session reactive file reader. In this example, all sessions share
# the same reader, so read.csv only gets executed once no matter how many
# user sessions are connected.
fileData <- reactiveFileReader(1000, session, 'data.csv', read.csv)
shinyServer(function(input, output, session)) {
  output$data <- renderTable({
    fileData()
  })
}
Documentation reproduced from package shiny, version 0.9.1, License: GPL-3

Community examples

Looks like there are no examples yet.