deparseOpts {base}R Documentation

Options for Expression Deparsing


Process the deparsing options for deparse, dput and dump.




control character vector of deparsing options.


This is called by deparse, dput and dump to process their control argument.

The control argument is a vector containing zero or more of the following strings. Partial string matching is used.

Either surround integer vectors by as.integer() or use suffix L, so they are not converted to type double when parsed. This includes making sure that integer NAs are preserved (via NA_integer_ if there are no non-NA values in the vector, unless "S_compatible" is set).
Surround expressions with quote(), so they are not evaluated when re-parsed.
If the object has attributes (other than a source attribute), use structure() to display them as well as the object value. This is the default for deparse and dput.
If the object has a source attribute, display that instead of deparsing the object. Currently only applies to function definitions.
Some exotic objects such as environments, external pointers, etc. can not be deparsed properly. This option causes a warning to be issued if any of those may give problems.
Integer, real and character NAs are surrounded by coercion where necessary to ensure that they are parsed to the same type.
An abbreviated way to specify all of the options listed above. This is the default for dump.
Deparse promises in the form <promise: expression> rather than evaluating them. The value and the environment of the promise will not be shown and the deparsed code cannot be sourced.
Make deparsing as far as possible compatible with S and R < 2.5.0. For compatibility with S, integer values of double vectors are deparsed with a trailing decimal point.

For the most readable (but perhaps incomplete) display, use control = NULL. This displays the object's value, but not its attributes. The default in deparse is to display the attributes as well, but not to use any of the other options to make the result parseable. (dput and dump do use more default options, and printing of functions without sources uses c("keepInteger", "keepNA").)

Using control = "all" comes closest to making deparse() an inverse of parse(). However, not all objects are deparse-able even with this option. A warning will be issued if the function recognizes that it is being asked to do the impossible.


A numerical value corresponding to the options selected.

[Package base version 2.5.0 Index]