Title: | An Interactive Editor for Viewing, Entering, Filtering & Editing Data |
---|---|
Description: | An interactive editor built on 'rhandsontable' to allow the interactive viewing, entering, filtering and editing of data in R <https://dillonhammill.github.io/DataEditR/>. |
Authors: | Dillon Hammill [aut, cre] |
Maintainer: | Dillon Hammill <[email protected]> |
License: | GPL-2 |
Version: | 0.1.6 |
Built: | 2024-11-17 03:54:46 UTC |
Source: | https://github.com/dillonhammill/dataeditr |
codedata_edit is a shiny application built on rhandsontable
that is
designed to make it easy to interactively view, enter or edit data without
any coding. data_edit
is also a wrapper for any reading or writing
function to make it easy to interactively update data saved to file.
data_edit( x = NULL, col_bind = NULL, col_edit = TRUE, col_options = NULL, col_stretch = FALSE, col_factor = FALSE, col_names = TRUE, col_readonly = NULL, row_bind = NULL, row_edit = TRUE, save_as = NULL, title = NULL, logo = NULL, logo_size = 30, logo_side = "left", viewer = "dialog", viewer_height = 800, viewer_width = 1200, theme = "yeti", read_fun = "read.csv", read_args = NULL, write_fun = "write.csv", write_args = NULL, quiet = FALSE, hide = FALSE, code = FALSE, cancel, ... )
data_edit( x = NULL, col_bind = NULL, col_edit = TRUE, col_options = NULL, col_stretch = FALSE, col_factor = FALSE, col_names = TRUE, col_readonly = NULL, row_bind = NULL, row_edit = TRUE, save_as = NULL, title = NULL, logo = NULL, logo_size = 30, logo_side = "left", viewer = "dialog", viewer_height = 800, viewer_width = 1200, theme = "yeti", read_fun = "read.csv", read_args = NULL, write_fun = "write.csv", write_args = NULL, quiet = FALSE, hide = FALSE, code = FALSE, cancel, ... )
x |
a matrix, data.frame, data.table or the name of a csv file to edit.
Tibbles are also supported but will be coerced to data.frames. An empty
table can be created by specifying the dimensions in a vector of the form
|
col_bind |
additional columns to add to the data prior to loading into editor, can be either an array containing the new data, a vector containing the new column names for empty columns or a named list containing a vector for each new column. |
col_edit |
logical indicating whether columns can be added or removed, set to TRUE by default. |
col_options |
named list containing the options for columns that use dropdown menus, dates, checkboxes or passwords. |
col_stretch |
logical indicating whether columns should be stretched to fill the full width of the display, set to FALSE by default. |
col_factor |
logical indicating whether character columns should be converted to factors prior to returning the edited data, set to FALSE by default. |
col_names |
logical indicating whether column names can be edited or a vector of column names that cannot be edited, set to TRUE by default to allow editing of column names. |
col_readonly |
names of columns that cannot be edited. Users will be able to edit values but these will be reverted to the original values. Column names for these column cannot be edited either. |
row_bind |
additional rows to add to the data prior to loading into editor, can be either an array containing the new data, a vector containing the new row names for empty rows or a named list containing a vector for each new column. |
row_edit |
logical indicating whether rows can be added or removed, set to TRUE by default. |
save_as |
name of a csv file to which the edited data should be saved. |
title |
optional title to include above the data editor. |
logo |
optional package logo to include in title above the data editor, must be supplied as path to logo png. |
logo_size |
width of the logo in pixels, set to 30 pixels by default. |
logo_side |
can be either |
viewer |
can be either |
viewer_height |
numeric to control the height of the viewer in pixels
when |
viewer_width |
numeric to control the width of the viewer in pixels when
|
theme |
valid shinytheme name, set to "yeti" by default. |
read_fun |
name of the function to use to read in the data when |
read_args |
a named list of additional arguments to pass to
|
write_fun |
name of the function to use to write the edited version of
|
write_args |
a named list of additional arguments to pass to
|
quiet |
logical indicating whether messages should be suppressed, set to FALSE by default. |
hide |
logical indicating whether the |
code |
logical indicating whether the code required to generate the
edited data should be printed to the console, set to |
cancel |
optional value to return when the user hits the |
... |
not in use. |
the edited data as a matrix or data.frame.
Dillon Hammill, [email protected]
if(interactive()) { data_edit(mtcars) }
if(interactive()) { data_edit(mtcars) }
Shiny module for data editing
dataEditUI(id) dataEditServer( id, data = reactive(NULL), col_bind = NULL, col_edit = TRUE, col_options = NULL, col_stretch = FALSE, col_names = TRUE, col_readonly = NULL, col_factor = FALSE, row_bind = NULL, row_edit = TRUE, row_index = reactive(NULL), quiet = FALSE, read_fun = "read.csv", read_args = NULL, ... )
dataEditUI(id) dataEditServer( id, data = reactive(NULL), col_bind = NULL, col_edit = TRUE, col_options = NULL, col_stretch = FALSE, col_names = TRUE, col_readonly = NULL, col_factor = FALSE, row_bind = NULL, row_edit = TRUE, row_index = reactive(NULL), quiet = FALSE, read_fun = "read.csv", read_args = NULL, ... )
id |
unique identifier for the module to prevent namespace clashes when making multiple calls to this shiny module. |
data |
a reactive expression containing an array (e.g. data.frame, matrix or data.table) or a vector indicating the dimensions of the array (e.g. c(10,10)) or column names to construct a new template for editing. If no data is supplied a template with 10 rows and columns will be generated for editing. |
col_bind |
additional columns to add to the data prior to loading into editor, can be either an array containing the new data, a vector containing the new column names for empty columns or a named list containing a vector for each new column. |
col_edit |
logical indicating whether columns can be added or removed, set to TRUE by default. |
col_options |
a list named with valid columns names and either
|
col_stretch |
logical indicating whether columns should be stretched to fill the full width of the display, set to FALSE by default. |
col_names |
logical indicating whether column names can be edited or a vector of column names that cannot be edited, set to TRUE by default to allow editing of column names. |
col_readonly |
names of columns that cannot be edited. Users will be able to edit values but these will be reverted to the original values. Column names for these column cannot be edited either. |
col_factor |
logical indicating whether character columns should be converted to factors prior to returning the edited data, set to FALSE by default. |
row_bind |
additional rows to add to the data prior to loading into editor, can be either an array containing the new data, a vector containing the new row names for empty rows or a named list containing a vector for each new column. |
row_edit |
logical indicating whether rows can be added or removed, set to TRUE by default. |
row_index |
indicates the starting index for new rows when the data
supplied to |
quiet |
logical to suppress warnings when using |
read_fun |
name of the function to use to read in the data when a file
is selected, set to |
read_args |
a named list of additional arguments to pass to
|
... |
additional arguments passed to
|
reactive expression containing the edited data.
Dillon Hammill, [email protected]
if (interactive()) { ui <- fluidPage( dataInputUI("input-1"), dataOutputUI("output-1"), dataEditUI("edit-1") ) server <- function(input, output, session) { data_to_edit <- dataInputServer("input-1") data_edit <- dataEditServer("edit-1", data = data_to_edit ) dataOutputServer("output-1", data = data_edit ) } shinyApp(ui, server) }
if (interactive()) { ui <- fluidPage( dataInputUI("input-1"), dataOutputUI("output-1"), dataEditUI("edit-1") ) server <- function(input, output, session) { data_to_edit <- dataInputServer("input-1") data_edit <- dataEditServer("edit-1", data = data_to_edit ) dataOutputServer("output-1", data = data_edit ) } shinyApp(ui, server) }
Shiny module for filtering data
dataFilterUI(id) dataFilterServer(id, data = reactive(NULL), hide = FALSE, hover_text = NULL)
dataFilterUI(id) dataFilterServer(id, data = reactive(NULL), hide = FALSE, hover_text = NULL)
id |
unique identifier for the module to prevent namespace clashes when making multiple calls to this shiny module. |
data |
an array wrapped in |
hide |
logical indicating whether the data filtering 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. |
a list of reactive objects containing the filtered data
and
indices for filtered rows
.
Dillon Hammill, [email protected]
if (interactive()) { library(shiny) library(rhandsontable) library(shinyjs) ui <- fluidPage( useShinyjs(), dataInputUI("input1"), dataFilterUI("filter1"), rHandsontableOutput("data1") ) server <- function(input, output, session) { data_input <- dataInputServer("input1") # list with slots data and rows (indices) data_filter <- dataFilterServer("filter1", data = data_input ) output$data1 <- renderRHandsontable({ if (!is.null(data_filter$data())) { rhandsontable(data_filter$data()) } }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(rhandsontable) library(shinyjs) ui <- fluidPage( useShinyjs(), dataInputUI("input1"), dataFilterUI("filter1"), rHandsontableOutput("data1") ) server <- function(input, output, session) { data_input <- dataInputServer("input1") # list with slots data and rows (indices) data_filter <- dataFilterServer("filter1", data = data_input ) output$data1 <- renderRHandsontable({ if (!is.null(data_filter$data())) { rhandsontable(data_filter$data()) } }) } shinyApp(ui, server) }
Shiny module for data input
dataInputUI(id, cellWidths = c("50%", "48%")) dataInputServer( id, data = NULL, read_fun = "read.csv", read_args = NULL, hide = FALSE, envir = parent.frame() )
dataInputUI(id, cellWidths = c("50%", "48%")) dataInputServer( id, data = NULL, read_fun = "read.csv", read_args = NULL, hide = FALSE, envir = parent.frame() )
id |
unique identifier for the module to prevent namespace clashes when making multiple calls to this shiny module. |
cellWidths |
a vector of length 2 to control the relative widths of the
|
data |
can be either the name of a dataset or file as a character string (e.g. "mtcars" or "mtcars.csv") or a vector column names (e.g. c("A", "B", "C")) or template dimensions (e.g. c(10,10)). |
read_fun |
name of the function to use to read in the data when a file
is selected, set to |
read_args |
a named list of additional arguments to pass to
|
hide |
logical indicating whether the data input user interface should be hidden from the user, set to FALSE by default. |
envir |
the environment in which to search for the supplied data, set to
the |
Dillon Hammill, [email protected]
if (interactive()) { library(shiny) library(rhandsontable) ui <- fluidPage( dataInputUI("input1"), rHandsontableOutput("data1") ) server <- function(input, output, session) { data_input1 <- dataInputServer("input1") output$data1 <- renderRHandsontable({ if (!is.null(data_input1())) { rhandsontable(data_input1()) } }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(rhandsontable) ui <- fluidPage( dataInputUI("input1"), rHandsontableOutput("data1") ) server <- function(input, output, session) { data_input1 <- dataInputServer("input1") output$data1 <- renderRHandsontable({ if (!is.null(data_input1())) { rhandsontable(data_input1()) } }) } shinyApp(ui, server) }
Shiny module for data output
dataOutputUI(id, icon = "download") dataOutputServer( id, data = reactive(NULL), save_as = NULL, write_fun = "write.csv", write_args = NULL, hide = FALSE, hover_text = NULL )
dataOutputUI(id, icon = "download") dataOutputServer( id, data = reactive(NULL), save_as = NULL, write_fun = "write.csv", write_args = NULL, hide = FALSE, hover_text = NULL )
id |
unique identifier for the module to prevent namespace clashes when making multiple calls to this shiny module. |
icon |
supplied to |
data |
an object of class data.frame wrapped in |
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_args |
a named list of additional arguments to pass to
|
hide |
logical indicating whether the data input 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. |
Dillon Hammill, [email protected]
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) }
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) }
Shiny module for selecting data
dataSelectUI(id) dataSelectServer(id, data = reactive(NULL), hide = FALSE, hover_text = NULL)
dataSelectUI(id) dataSelectServer(id, data = reactive(NULL), hide = FALSE, hover_text = NULL)
id |
unique identifier for the module to prevent namespace clashes when making multiple calls to this shiny module. |
data |
an array wrapped in |
hide |
logical indicating whether the data selection 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. |
a list of reactive objects containing the filtered data
and
indices for selected columns
.
Dillon Hammill, [email protected]
if (interactive()) { library(shiny) library(rhandsontable) library(shinyjs) ui <- fluidPage( useShinyjs(), dataInputUI("input1"), dataSelectUI("select1"), rHandsontableOutput("data1") ) server <- function(input, output, session) { data_input <- dataInputServer("input1") data_select <- dataSelectServer("select1", data = data_input ) output$data1 <- renderRHandsontable({ if (!is.null(data_select$data())) { rhandsontable(data_select$data()) } }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(rhandsontable) library(shinyjs) ui <- fluidPage( useShinyjs(), dataInputUI("input1"), dataSelectUI("select1"), rHandsontableOutput("data1") ) server <- function(input, output, session) { data_input <- dataInputServer("input1") data_select <- dataSelectServer("select1", data = data_input ) output$data1 <- renderRHandsontable({ if (!is.null(data_select$data())) { rhandsontable(data_select$data()) } }) } shinyApp(ui, server) }
The purpose of this module is to merge changes made to a subset of the data with the master copy of the data.
dataSyncUI(id) dataSyncServer( id, data = reactive(NULL), data_subset = reactive(NULL), rows = reactive(NULL), columns = reactive(NULL), hide = FALSE, hover_text = NULL )
dataSyncUI(id) dataSyncServer( id, data = reactive(NULL), data_subset = reactive(NULL), rows = reactive(NULL), columns = reactive(NULL), hide = FALSE, hover_text = NULL )
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 |
rows |
the row indices of |
columns |
the column indices of |
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. |
Dillon Hammill, [email protected]
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) }
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) }