Description Usage Arguments Details Large number of digits Single-byte locales Unicode and other multi-byte locales See Also Examples
print.default
is the default method of the generic
print
function which prints its argument.
1 2 3 4 |
x |
the object to be printed. |
digits |
a non-null value for |
quote |
logical, indicating whether or not strings
( |
na.print |
a character string which is used to indicate
|
print.gap |
a non-negative integer ≤ 1024,
or |
right |
logical, indicating whether or not strings should be right aligned. The default is left alignment. |
max |
a non-null value for |
useSource |
logical, indicating whether to use source references or copies rather than deparsing language objects. The default is to use the original source if it is available. |
... |
further arguments to be passed to or from other methods. They are ignored in this function. |
The default for printing NA
s is to print NA
(without
quotes) unless this is a character NA
and quote =
FALSE
, when <NA> is printed.
The same number of decimal places is used throughout a vector. This
means that digits
specifies the minimum number of significant
digits to be used, and that at least one entry will be encoded with
that minimum number. However, if all the encoded elements then have
trailing zeroes, the number of decimal places is reduced until at
least one element has a non-zero final digit. Decimal points are only
included if at least one decimal place is selected.
Attributes are printed respecting their class(es), using the values of
digits
to print.default
, but using the default values
(for the methods called) of the other arguments.
Option width
controls the printing of vectors, matrices and
arrays, and option deparse.cutoff
controls the printing of
language objects such as calls and formulae.
When the methods package is attached, print
will call
show
for R objects with formal classes if called
with no optional arguments.
Note that for large values of digits
, currently for
digits >= 16
, the calculation of the number of significant
digits will depend on the platform's internal (C library)
implementation of sprintf() functionality.
If a non-printable character is encountered during output, it is represented as one of the ANSI escape sequences (\a, \b, \f, \n, \r, \t, \v, \\ and \0: see Quotes), or failing that as a 3-digit octal code: for example the UK currency pound sign in the C locale (if implemented correctly) is printed as \243. Which characters are non-printable depends on the locale. (Because some versions of Windows get this wrong, all bytes with the upper bit set are regarded as printable on Windows in a single-byte locale.)
In all locales, the characters in the ASCII range (0x00 to 0x7f) are printed in the same way, as-is if printable, otherwise via ANSI escape sequences or 3-digit octal escapes as described for single-byte locales.
Multi-byte non-printing characters are printed as an escape sequence of the form \uxxxx or \Uxxxxxxxx (in hexadecimal). This is the internal code for the wide-character representation of the character. If this is not known to be Unicode code points, a warning is issued. The only known exceptions are certain Japanese ISO 2022 locales on commercial Unixes, which use a concatenation of the bytes: it is unlikely that R compiles on such a system.
It is possible to have a character string in a character vector that is not valid in the current locale. If a byte is encountered that is not part of a valid character it is printed in hex in the form \xab and this is repeated until the start of a valid character. (This will rapidly recover from minor errors in UTF-8.)
The generic print
, options
.
The "noquote"
class and print method.
encodeString
, which encodes a character vector the way
it would be printed.
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.