Learn R Programming

Rcmdr (version 2.9-4)

editDataset: R Commander Dataset Editor

Description

Allows the user to enter a new dataset, modify data values in an existing dataset, add rows or columns to the dataset, or delete rows or columns.

Usage

editDataset(data, dsname, ...)
# S3 method for data.frame
editDataset(data, dsname, ...)
# S3 method for character
editDataset(data, dsname, ...)
# S3 method for NULL
editDataset(data, dsname, ...)

Value

This function does not return a useful value, but has the side effect of modifying or creating a data set in the global environment.

Arguments

data

an R data frame to edit; this argument is optional, and if absent an empty data frame is created, into which the user can enter data.

dsname

the quoted name of the data set, into which the edited data frame will be placed in the global environment. If absent and an existing data frame is edited, the modified version will replace the original version; if absent and a new data set is created, it will be given the name "Dataset".

...

not used by the data.frame method.

Author

John Fox jfox@mcmaster.ca

Details

editDataset is a straightforward spreadsheet-like data editor, suitable for editing data frames that are not too large (say smaller than about 10,000 values). It is defined as a generic function with a data.frame method to allow for objects with unique properties that inherit from the data.frame class. The character and NULL methods permit editing an initially empty data set.

  • Use the mouse and the arrow keys to navigate the cells of the data table, including the row and column names.

  • Columns consisting only of numbers will produce numeric variables in the data frame constructed by editDataset; columns with any non-numeric values will produce factors or (if they contain only the values TRUE and FALSE) logical variables.

  • When entering values with embedded blanks, it is permissible but not necessary to enclose the values in quotes (e.g, "some PS" or 'less than HS').

  • Clicking in a cell and typing a new value replaces the previous value.

  • Row and column names can be modified in the same manner.

  • Double-clicking in a cell deletes the previous value and replaces it with NA.

  • Enlarge the data set by pressing the Add row or Add column button at the top of the data editor; the new row or column will initially be filled with NAs and will have an auto-generated row or column name. Pressing the Enter or Return key will also add a row; pressing the Tab key will also add a column.

  • Right-clicking (or Control-clicking, or under Mac OS X Command-clicking) brings up a context menu, permitting several operations on cells, rows, and columns, including deleting the current row or column.

  • Similarly, several actions are available via the Edit menu.

  • The key-combinations Control-x, and Control-v, may also be used respectively to cut, copy, and paste cell values. (Under Mac OS X, Command-x, Command-c, and Command-v also work.)

  • Pressing the OK button or selecting Exit and save from the File menu exits the data edtior and saves the edited data set to the global environment. Pressing the Cancel button or selecting Cancel from the File menu exits the editor discarding the edited data set.

See Also

edit.data.frame, for the standard R data editor.

Examples

Run this code
  if (interactive()) editDataset()

Run the code above in your browser using DataLab