dataSync: A shiny module to synchronise datasets

dataSyncR Documentation

A shiny module to synchronise datasets

Description

The purpose of this module is to merge changes made to a subset of the data with the master copy of the data.

Usage

dataSyncUI(id)

dataSyncServer(
  id,
  data = reactive(NULL),
  data_subset = reactive(NULL),
  rows = reactive(NULL),
  columns = reactive(NULL),
  hide = FALSE,
  hover_text = NULL
)

Arguments

id

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

data

master copy of the data.

data_subset

subset of data with altered entries.

rows

the row indices of data_subset within data.

columns

the column indices of data_subset within data.

hide

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

hover_text

text to display on download button when user hovers cursor over button, set to NULL by default to turn off hover text.

Author(s)

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

Examples

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

 ui <- fluidPage(
   useShinyjs(),
   dataInputUI("input1"),
   dataFilterUI("filter1"),
   dataSyncUI("sync1"),
   dataEditUI("edit1")
 )

 server <- function(input,
                    output,
                    session) {

   values <- reactiveValues(
     data = NULL,
     data_subset = NULL
   )

   data_input <- dataInputServer("input1")

  data_edit <- dataEditServer(
     "edit1",
     data = data_input
   )

   data_sync <- dataSyncServer(
     "sync1",
     data = data_input,
     data_subset = data_edit,
     rows = NULL,
     columns = NULL
   )

  }
 shinyApp(ui, server)
}


DillonHammill/DataEditR documentation built on Oct. 4, 2022, 10:41 a.m.