| tableEdit {rNMR} | R Documentation |
A GUI for editing and sorting tables.
tableEdit(data, editable = rep(TRUE, ncol(data)), title = 'rNMR', colVer = NULL,
errMsgs = rep(paste('Data type for new entry must',
'match the data type for a given column.'), ncol(data)))
data |
data.frame or character string/vector; the table to sort/edit or a vector of valid file names. |
editable |
logical vector; indicates which columns may be edited, must
be equal in length to the number of columns in data. |
title |
character string; the title for the GUI. |
colVer |
function list; functions, one for each column, used to verify
the entries in each column. Functions should return TRUE or
FALSE and should be capable of vector operations. |
errMsgs |
character vector; error messages to display if functions in
colVer return FALSE, should be the same length as colVer.
If NULL, no error messages are displayed. |
tableEdit displays a GUI for editing and sorting tables. Tables must
be valid data.frames with columns of equal length. The editable
argument must be a logical vector indicating which columns in data may
be edited. If any of the values in editable are TRUE, entries
from the corresponding columns in data may be edited by clicking on a
table entry in the GUI. To edit multiple entries, select the items in the
table you wish to edit, type your changes in the text box at the bottom of
the GUI, and press the Apply button. Rows in the table may be edited
using the options provided at the bottom of the GUI.
Functions provided by the colVer argument will be used to verify the
data in each column. colVer, if provided, must be a list of functions
that return TRUE or FALSE. If a function returns TRUE,
the new entry(s) will be accepted and the table will be modified. If
FALSE, the table will not be modified and a general error message will
be displayed. The errMsgs argument allows custom error messages to be
displayed for each function. Both of these arguments are optional, but if
provided, they must have length equal to the number of columns in the table.
Before functions in colVer are applied, tableEdit attempts to
coerce entries in each column to a type matching that of the input table
(i.e. - if the entries in a given column were passed to tableEdit as
type numeric, tableEdit will attempt to coerce new entries to
numeric, returning NA for values that fail). A practical
example of this functionality can be seen in the ROI table editor (see
re).
If the OK is pressed, the table will be returned with any modifications
as a data.frame with column names matching those of the input table.
Note that the "significant figures" option within the GUI only affects how the
data is displayed, the values returned after pressing the OK will
remain unchanged. Pressing the Cancel button will close the GUI and
return NULL. Pressing the Export button will save the data as a
tab-delimited text file, exactly as it appears in the table.
Ian A. Lewis ialewis@nmrfam.wisc.edu, Seth C. Schommer schommer@nmrfam.wisc.edu
fs for sorting files; re for editing
and sorting ROIs; toolkit for other rNMR utility functions.