Data Formatting in R

There are a number of ways to accomplish data formatting in R.

Data Options in R

R supports a range of data formats and controls.  The options() function accesses the default settings R establishes at start-up.  Session options that can be changed from the command line include:

Each of these variables can be changed to modify R performance.  For more details on each element see the HTML help for the options() function.  A practical example is given below.

Data Formats in R

The options() function is frequently used to set the digit setting.  In practice, the format change does not impact the data object, its’ content or precision, just data object’s appearance. 

Meanwhile, the format() function can used to achieve pretty printing:

Data Object Editing

The best way to edit data objects is in R directly.  However, R data objects can also be edited by invoking a text editor with the fix() and edit() functions.  Both functions launch the text editor as specified by the editor argument in the option() function. Once the editor is open, a window similar to a crude spreadsheet appears, and data object elements can be changed manually.  All changes are then saved back to the .Data folder when the editor is closed.

Back | Next

Leave a Reply

Your email address will not be published. Required fields are marked *