Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dataOutput

Shiny module for data output


Description

Shiny module for data output

Usage

dataOutputUI(id, icon = "download")

dataOutputServer(
  id,
  data = reactive(NULL),
  save_as = NULL,
  write_fun = "write.csv",
  write_args = NULL,
  hide = FALSE
)

Arguments

id

unique identifier for the module to prevent namespace clashes when making multiple calls to this shiny module.

icon

supplied to dataOutputUI to control the appearance of the icon displayed on the download button, set to "download" by default.

data

an object of class data.frame wrapped in reactive to be saved to file.

save_as

name of the file to which the data should be saved, overrides input file path if supplied.

write_fun

name of the function to use when writing the data to file, set to "write.csv" by default.

write_args

a named list of additional arguments to pass to write_fun when reading in files.

hide

logical indicating whether the data input user interface should be hidden from the user, set to FALSE by default.

Author(s)

Dillon Hammill, Dillon.Hammill@anu.edu.au

Examples

if (interactive()) {
  library(shiny)
  library(rhandsontable)
  library(shinyjs)

  ui <- fluidPage(
    useShinyjs(),
    dataInputUI("input1"),
    dataOutputUI("output1"),
    rHandsontableOutput("data1")
  )

  server <- function(input,
                     output,
                     session) {
    data_input1 <- dataInputServer("input1")

    output$data1 <- renderRHandsontable({
      if (!is.null(data_input1())) {
        rhandsontable(data_input1())
      }
    })

    dataOutputServer("output1",
      data = data_input1
    )
  }

  shinyApp(ui, server)
}

DataEditR

An Interactive Editor for Viewing, Entering, Filtering & Editing Data

v0.1.1
GPL-2
Authors
Dillon Hammill [aut, cre] (<https://orcid.org/0000-0002-1407-7223>)
Initial release
2021-05-10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.