rhandsontable is no longer a
dependency, so the forked rhandsontable is no longer required and the
CRAN version works as intended.1,234.5, $12, 45%), d/m/y and m/d/y dates and yes/no, and asks
once about values that do not fit their columns. Copying quotes cells with
line breaks and copies an HTML table for spreadsheets.col_options: "datetime", "time", "textarea",
"url", "colour", "slider", "rating" and numbers within limits
(c(min = 0, max = 10, step = 0.5)), alongside checkboxes, dropdowns,
"date" and "password". Slider limits and rating stars are set with
e.g. c(type = "slider", min = 0, max = 1, step = 0.05). Values that do
not fit a column's input are caught whether they are typed or pasted, and
values already in the data that do not fit are marked.NA (they were empty strings), like cells that were cleared.col_factor = TRUE, which
now only converts character columns.code) starts from the data that was opened from the
Open menu, returns matrices as matrices and new tables as data frames,
and recreates factors with the same levels as the returned data.YYYY-MM-DD values (as.Date() read
15/03/2024 as the year 15); other formats are converted in the browser
before they reach R.col_options no longer disables adding or removing columns, and
col_readonly columns are locked in the grid rather than reverted after
editing.track now highlights cells
with a tinted fill that is distinct from the range selection.NA logical columns, not NA_character_ or columns with an input in
col_options) are passed through type.convert() on return, so character
columns such as "001" are no longer converted to numbers. Dates stay
dates, and matrices, tibbles and data.tables are returned with their
original class.Every issue opened on GitHub for earlier versions was checked against this
release. Besides the changes above (edits returned by Done without a
sync button, undo, validation, date pickers, sliders, find and replace,
hidden columns, filters that keep working with any number of filters and
with filtered edits, factors, pasting that adds rows and columns, editing in
shiny modals and with data that changes), these were fixed or added:
col_options (as for shiny::selectInput())
makes a dropdown that shows the names and stores the values (#76).col_options = list(x = "dropdown") makes a dropdown of the values in the
column, or of its levels for a factor (#14). Dropdowns of numbers on numeric
columns return numbers, as in 1.x.col_options type "integer" takes whole numbers and returns integers;
list(type = "integer", min = 0, max = 10) adds limits. The step of a
number input is now checked as well as its limits (#37).col_readonly, col_hide, col_options or col_widths
that are not in the data are ignored with a message instead of an error,
so the same settings can be used for different data in an app (#37).col_widths sets the starting width of columns in pixels, and columns
with long text start at most 320 pixels wide (#74).col_options type "html" shows cells as HTML (links, line breaks,
images, ...) without scripts, styles or event handlers (#69).Insert cells, shift down and Delete cells, shift up in the cell menu
move the cells below a selection, in its columns only (#53).Ctrl+Shift+V pastes a block with its first row as column names (#36).row_names = FALSE keeps row names out of sight while returning them
(#40). A row name that another row already has is refused, instead of
the row names being moved to a column on return (#1).! keep the rows that do not contain the text,
as the old not contain filter did (#67).sf objects are returned as sf objects: their geometry, and any other
list column, is shown as text and kept read-only while the other columns
are edited (#52). Rows can be added to data with list columns. A geometry
column on its own (sfc) opens as an sf object.read_fun and write_fun accept "pkg::fun", e.g.
"readxl::read_excel" (#70). save_as that is not a file (e.g. a Google
Sheet written by write_fun) no longer breaks the Done and Export
menus (#26). Data without row names is written without a column of row
numbers (#71), and data_edit() says where it saved the data (#62).POSIXct in UTC) keep their time zone,
and the generated code gives their new values in it, so the code
reproduces the edits in any time zone (#34).dataOutputServer() returns the data it saves, so
edited <- dataOutputServer(...) followed by renderTable(edited())
works (#51). Its download is written as data_edit() writes files.dataInputUI(), dataOutputUI(), dataFilterUI(), dataSelectUI() and
dataSyncUI() load shinyjs themselves, so hide = TRUE works without
useShinyjs() (#19, #28). Hidden toolbar buttons stay hidden in apps that
use shiny's default Bootstrap 3 theme.options(warnPartialMatchArgs = TRUE, warn = 2) (#64).formats colours cells by their values, without changing the data: rules
(one-sided formulas) give the cells of the columns they use, other
columns or whole rows a fill, a text colour and/or bold text, and colour
scales shade the numbers of a column from a low to a high colour (two or
three colours, with optional limits and mid). Formats are updated after
every change; when several colour a cell, the later one wins.Conditional formatting... in a column's menu adds formats in the editor:
highlight the column's cells or whole rows where the value is above, below,
between or equal to values, contains text, is blank, duplicated, above or
below average, among the highest or lowest, or makes a formula TRUE, in
one of several styles; or shade the column with a colour scale. The dialog
previews how many rows match, lists the column's formats (with the code to
add each to formats) and removes them. Formats added in the editor are
kept in drafts.track = TRUE); set
track = FALSE to turn the highlight off.Load, Upload... and Create buttons of the Open menu have their
text centred and match the height of the fields next to them.Shift+F2) to add,
edit or delete one, or delete them all at once (after confirming). Commented cells get an amber corner, and the comment
shows when the pointer rests on the cell and in the record form. Comments
are kept in drafts and returned with the data as attr(x, "comments"), a
data frame of the row, column, comment, user and time; data
opened with that attribute shows its comments. Comments on database rows
follow the rows when changes are committed or other rows are loaded.Week 1, Week 2) carry on as a series, and anything
else is repeated. Hold Ctrl to copy without a series. A fill is one undo
step, and values that do not fit a column are asked about first, as for a
paste.V1, V2, ...) unless col_edit = FALSE; extra values were
ignored.col_options = list(x = "colour")) are edited with a
colour picker: type a colour, pick a swatch (the colours already in the
column, then R's palette and the Okabe-Ito palette) or any colour with the
browser's picker. list(type = "colour", palette = c(...)) sets the
swatches offered. R colour names such as "grey50" now show the right
swatch (R's "green" and "gray" are not the CSS ones), and values that
are not colours get a dashed one.History tab lists earlier editing sessions of the same data, newest
first and folded away: data_edit(log = "file.csv") reads them from its
file, and dataEditServer(history = ) takes a data frame (or a reactive)
of earlier log entries, for example read from a database table. The change
log has a new session column (when the editing session started) to tell
sessions apart; log files written before keep their columns.Code tab is much faster on big data: on 100,000 rows it takes about
0.6 s after column actions (was about 5 s) and 0.3 s after edits (was
1.5 s), with the same code.db_table(limit = ), default
getOption("DataEditR.db_rows", 100000); it was all rows). The header and
a new Rows button in the toolbar show how many rows are loaded out of
how many there are.dplyr::filter() (translated to SQL by dbplyr, limited to columns and the
functions formulas may use), sorted by a column, at most a number of rows.
The dialog counts the matching rows first, and unsaved changes are saved
to the database or discarded before other rows are loaded.db_table(readonly = FALSE) still stops with an error, and
readonly = TRUE opens any table read-only..sav, .por), Stata (.dta) and SAS (.sas7bdat, .xpt) files
are read with haven, from a file name or the Open menu (unless read_fun
is given). save_as files ending in .sav, .dta or .xpt are written
with haven, and the Export menu can download SPSS and Stata files.haven_labelled, or the labels
attribute of labelled/sjlabelled) and SPSS user-defined missing values
are kept through every edit, added and removed rows, undo and column
actions. Variable labels of plain columns were dropped when rows were
added or removed, and text columns with value labels made the editor fail.lbl badge. The cell editor lists the labels, and labels typed, pasted or
entered in the record form are stored as their values. User-defined
missing values are shown muted and count as missing in summaries and the
"is missing" filter.value = label per line), recorded as one step in the code.
Change type turns labelled columns into factors or text with their
labels (haven::as_factor()) or into plain values (haven::zap_labels()).NA) and puts back variable labels that tibble::add_row() drops.
Formulas may use haven::as_factor(), zap_labels(), zap_label(),
labelled(), labelled_spss() and structure().col_summary = FALSE leaves them out.Record tab (and toolbar button) shows the selected row as a form,
for entering or checking data one record at a time. Its fields use the
column inputs and checks of the grid, show broken rules under the fields
and move with the grid; New adds a row at the end.⋮ button in its header, or a right-click) has
actions that change the whole column: Formula... (a new column or new
values from an R expression such as round(mpg * 0.425, 1)), Find and
replace..., Recode values..., Change type and sorting. Each shows
a preview and is recorded as one dplyr verb (mutate(), arrange()), so
the generated code says what was done rather than listing every changed
value. The editor runs that same verb, so the code gives exactly the
result, and checks this before showing it. Formulas can only use columns
and common functions, so they are safe in shiny apps. Turn the actions off
with col_actions = FALSE.rules checks the data as it is edited: formulas that are TRUE for valid
rows, named with their messages (e.g. "End is after the start" = ~ end >= start). Cells that break a rule are marked, a new Problems tab lists
them, the status bar counts them and Done asks before returning data with
problems. Columns can be made required or unique, given limits or a
pattern, or a formula, from their menu (Rules...). dataEditProblems()
returns the problems in shiny apps.mutate(..., .after = )).code column with the verb of column actions.History tab of the review panel lists the changes step by step, and each
step can be given a note saying why it was made.data_edit(log = "changes.csv") adds the change log to a csv file when
Done is pressed (or passes it to a function), so one file can keep the
history of many editing sessions.autosave = TRUE). If the
editor is closed without pressing Done or Cancel, opening the same data
again offers to restore the changes with their history. Drafts are kept in
tools::R_user_dir("DataEditR", "data") and removed after 30 days.Cancel asks before changes are thrown away.dataEditLog() returns the change log, dataEditCommit()
returns the log of the changes it saved, and dataEditServer() gains
autosave and user arguments.?).TRUE/FALSE/missing buttons
for logicals; and words to look for in text. Rows can match all or any of
the filters, each card says how many rows it keeps and cards fold to a
sentence such as "is between 15 and 25". Add filter lists the columns with
a sparkline or the number of values, and can be searched. It has the logics
of the 1.x dialog in plain words (is any of, is none of, is above, is below,
is between, contains, ...) plus matches the pattern (regular expressions),
is missing and is not missing, for numbers, text, dates and times. Filters
set under the column headers or from column summaries are listed too, and
stay where they are unless they are changed (a !text header filter is
listed as does not contain). Dropdowns with names list and show the names,
HTML columns are searched as their text, and password values are never
listed. between now includes its end points and contains looks for plain
text, ignoring case (1.x used regular expressions; use matches the pattern). The dataFilter module is still exported.page_rows and page_cols open the editor in pages), with
buttons to move between them. Filters, find, paste, new rows, Done and
exports work across every page.+ in the corner above the row numbers adds a row or a column (a menu
with both), instead of a bar under the grid and a + after the last column.Summary, Select (was Columns),
Filters, Form and Review (was Review changes), and Find in data is
in the status bar. The side panel's Record tab is now Form.data_edit() (the
dataSelect module is still exported).data_code() output as you edit. When
rows are filtered or columns hidden, the Code tab adds the filter() and
select() that give the rows and columns on screen (header boxes, column
summaries and the Filters panel, matching all or any), checked by running
it; rows it cannot explain are picked by position. code = with "Only
what's on screen" ends with the same steps.NA,
convert the column to text or cancel, instead of silently converting the
column. "NA" is treated as a missing value in typed columns.save_as, whether to save.dataInput/dataOutput row; both modules are
still exported.theme = NULL); Bootswatch names such as
"yeti" now select the Bootstrap 5 version. shinyBS and miniUI are no
longer dependencies.data_edit() and dataEditServer() accept dbplyr lazy tables (e.g.
data_edit(tbl(con, "artists")), optionally filtered), or a db_table().
Rows are matched by primary key (detected for SQLite, DuckDB and
PostgreSQL), edits are staged until Done, the user confirms a summary, and
changes are written in a single transaction with optimistic concurrency
checks (the commit is rolled back if any row changed in the database since it
was loaded). Columns that are not part of the table are read-only and schema
changes are disabled.code = TRUE generates rows_update(), rows_append() and rows_delete()
code for database edits.dataEditCommit() saves the changes made in a dataEditServer()
editor, so shiny applications can write database edits (in a single
transaction, rolled back with an editr_conflict error if rows changed in
the meantime) and read the rows back with the keys the database generated.
For other data the current data becomes the new starting point for the
review panel and change tracking. dataEditChanges() returns a summary of
the changes that have not been saved yet.data_edit() returns database rows as read back after the commit, so new
rows include their generated keys.data_code() now inserts added rows at their edited positions using
tibble::add_row(.before = ), so the generated code reproduces row order.dataFilterServer() and dataSelectServer() gain a reset argument so
filters are kept while data is edited; dataSelectServer() also returns the
selected column names.dataFilter filters being re-created by stale observers after
"Remove Filters".row_bind adds typed empty rows, so numeric columns stay numeric.dataEditServer() gains rows and columns arguments to display a subset
of the data; row_index is no longer needed.dataEditServer() applies rows and columns when the data is first
loaded (and when it is reloaded), not only when they change.dataInputServer() can load an uploaded file after an R object, and no
longer fails on data without columns.dataOutputServer() no longer loops when the first column holds row names.dataFilterServer() has been simplified: filters without levels are
ignored, "between" accepts its limits in any order, and "not between" or
"not contain" filters that match every row return no rows.col_bind lists without names get unique column names (V1, V2, ...).db_table(x, table = , key = ), and factor values are written as text.`main`.`cars`).shiny::testServer())
and the database backend, with over 95% code coverage.track parameter in data_edit() and
dataEditServer(). Set track = TRUE to highlight edited and added cells
with a blue border, or pass a CSS color string (e.g. track = "red") for a
custom highlight colour. Uses Handsontable's afterRenderer hook and
name-based cell matching so that inserted rows or columns no longer cause all
subsequent cells to appear changed.data_code() function and
updated code argument in data_edit(). Instead of dput() output, the
editor now generates human-readable dplyr pipe code using rename(),
select(), mutate(), slice(), and tibble::add_row() to replicate
column renames, additions/removals, cell value changes, and row
additions/removals. Row names (e.g. those in mtcars) are preserved via
tibble::rownames_to_column() / tibble::column_to_rownames().values$cols instead of values$columns).auto parameter to dataSyncServer() to allow automatic synchronisation
when used as a standalone module.hot_context_menu. Factor columns are now converted to
character before rendering and converted back on output via col_factor.dataFilter "not between" and "not contain" filter logic which
incorrectly used ncol() instead of nrow(), causing wrong row indices to
be returned.dataFilter multi-filter intersection which used duplicated() and
missed rows matching all filters when no duplicates existed. Now uses
table() to correctly compute the intersection.input$x race condition in dataEditServer() when switching
reactive data. A data_loading flag now prevents the old table's
input$x from overwriting values$x before the new data has rendered.values$cols instead of values$columns).auto parameter to dataSyncServer() to allow automatic synchronisation
when used as a standalone module.cancel argument to data_edit() to allow control over return value when the data editor is deliberately closed by the user, set to the original input dat by default.bslib for more flexibility in setting custom themes data_edit(). Users can now supply a bs_theme object to the theme argument to fully customise the appearance of the data_edit() UI.data_edit() calls within RStudio.dataInput.dataInput and dataEdit to ensure that the supplied data always contains as least a single row and column.googlesheets by calling write_fun as the application closes.data_edit() to ensure that we don't search for data through RStudio addin if RStudio is not in use.. can be loaded into the data editor.dataSync module to handle synchronisation of an edited data subset with the complete dataset.dataFilter to ensure the logic and levels are always updated when the column selection changes.data_edit() can now export the code required to generate the final edited version of the data to an R script.code argument.dataInput searches for data outside data_edit().data_edit() directly.write_fun whenever save_as is supplied.dataSelect and dataFilter examples now that the return values are lists instead of reactive expressions.rhandsontable from install_github("DillonHammill/rhandsontable").dataSelect and dataFilter modules to filter data,Sync button to update the entire dataset with changes made to a subset. Data is still exported as a whole but a new button could be added in the future to export the subsetted data.cut button to allow return of subsetted data upon closing the application with the Done button.dataInput, dataEdit and dataOutput modules.dialog box, browser or RStudio viewer pane. This can be controlled through the viewer argument and has been set to use a dialog box by default. Additional arguments viewer_height and viewer_width have been added to allow control over the dimensions of dialog boxes.hide argument to optionally display the dataInput and dataOutput modules. This functionality requires the shinyjs package. The hide argument allows users to maximize the space available to display the data and also prevent users from interacting with these modules. It is still possible to save data to file when dataOutput module is not visible, by simply supplying the file name to the save_as argument of data_edit().dataEdit module.data_edit() to make it easier to create data.frames from scratch. The default template size has been increased to be a 10 x 10 grid.logo_side argument to control whether the logo should be placed on the left or right of the title.code argument to data_edit() to print the code required to create the edited data to the console.data_edit() to construct a template data.frame with pre-defined column names.col_readonly argument to prevent users from editing values or column names of certain columns.col_names argument to allow control over which column names can be edited by the user.data_edit() to allow interactive data viewing, entry and editing.