EVOLUTION-MANAGER
Edit File: print.default.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Default Printing</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for print.default {base}"><tr><td>print.default {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Default Printing</h2> <h3>Description</h3> <p><code>print.default</code> is the <em>default</em> method of the generic <code><a href="print.html">print</a></code> function which prints its argument. </p> <h3>Usage</h3> <pre> ## Default S3 method: print(x, digits = NULL, quote = TRUE, na.print = NULL, print.gap = NULL, right = FALSE, max = NULL, useSource = TRUE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>the object to be printed.</p> </td></tr> <tr valign="top"><td><code>digits</code></td> <td> <p>a non-null value for <code>digits</code> specifies the minimum number of significant digits to be printed in values. The default, <code>NULL</code>, uses <code><a href="options.html">getOption</a>("digits")</code>. (For the interpretation for complex numbers see <code><a href="Round.html">signif</a></code>.) Non-integer values will be rounded down, and only values greater than or equal to 1 and no greater than 22 are accepted. </p> </td></tr> <tr valign="top"><td><code>quote</code></td> <td> <p>logical, indicating whether or not strings (<code><a href="character.html">character</a></code>s) should be printed with surrounding quotes.</p> </td></tr> <tr valign="top"><td><code>na.print</code></td> <td> <p>a character string which is used to indicate <code><a href="NA.html">NA</a></code> values in printed output, or <code>NULL</code> (see ‘Details’).</p> </td></tr> <tr valign="top"><td><code>print.gap</code></td> <td> <p>a non-negative integer <i>≤ 1024</i>, or <code>NULL</code> (meaning 1), giving the spacing between adjacent columns in printed vectors, matrices and arrays.</p> </td></tr> <tr valign="top"><td><code>right</code></td> <td> <p>logical, indicating whether or not strings should be right aligned. The default is left alignment.</p> </td></tr> <tr valign="top"><td><code>max</code></td> <td> <p>a non-null value for <code>max</code> specifies the approximate maximum number of entries to be printed. The default, <code>NULL</code>, uses <code><a href="options.html">getOption</a>("max.print")</code>; see that help page for more details.</p> </td></tr> <tr valign="top"><td><code>useSource</code></td> <td> <p>logical, indicating whether to use source references or copies rather than deparsing <a href="is.language.html">language objects</a>. The default is to use the original source if it is available.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further arguments to be passed to or from other methods. They are ignored in this function.</p> </td></tr> </table> <h3>Details</h3> <p>The default for printing <code>NA</code>s is to print <code>NA</code> (without quotes) unless this is a character <code>NA</code> <em>and</em> <code>quote = FALSE</code>, when <span class="samp"><NA></span> is printed. </p> <p>The same number of decimal places is used throughout a vector. This means that <code>digits</code> 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. </p> <p>Attributes are printed respecting their class(es), using the values of <code>digits</code> to <code>print.default</code>, but using the default values (for the methods called) of the other arguments. </p> <p>Option <code>width</code> controls the printing of vectors, matrices and arrays, and option <code>deparse.cutoff</code> controls the printing of <a href="is.language.html">language objects</a> such as calls and formulae. </p> <p>When the <span class="pkg">methods</span> package is attached, <code>print</code> will call <code><a href="../../methods/html/show.html">show</a></code> for <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> objects with formal classes if called with no optional arguments. </p> <h3>Large number of digits</h3> <p>Note that for large values of <code>digits</code>, currently for <code>digits >= 16</code>, the calculation of the number of significant digits will depend on the platform's internal (C library) implementation of <span class="samp">sprintf()</span> functionality. </p> <h3>Single-byte locales</h3> <p>If a non-printable character is encountered during output, it is represented as one of the ANSI escape sequences (<span class="samp">\a</span>, <span class="samp">\b</span>, <span class="samp">\f</span>, <span class="samp">\n</span>, <span class="samp">\r</span>, <span class="samp">\t</span>, <span class="samp">\v</span>, <span class="samp">\\</span> and <span class="samp">\0</span>: see <a href="Quotes.html">Quotes</a>), 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 <span class="samp">\243</span>. 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.) </p> <h3>Unicode and other multi-byte locales</h3> <p>In all locales, the characters in the ASCII range (<span class="samp">0x00</span> to <span class="samp">0x7f</span>) 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. </p> <p>Multi-byte non-printing characters are printed as an escape sequence of the form <span class="samp">\uxxxx</span> or <span class="samp">\Uxxxxxxxx</span> (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 <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> compiles on such a system. </p> <p>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 <span class="samp">\xab</span> and this is repeated until the start of a valid character. (This will rapidly recover from minor errors in UTF-8.) </p> <h3>See Also</h3> <p>The generic <code><a href="print.html">print</a></code>, <code><a href="options.html">options</a></code>. The <code>"<a href="noquote.html">noquote</a>"</code> class and print method. </p> <p><code><a href="encodeString.html">encodeString</a></code>, which encodes a character vector the way it would be printed. </p> <h3>Examples</h3> <pre> pi print(pi, digits = 16) LETTERS[1:16] print(LETTERS, quote = FALSE) M <- cbind(I = 1, matrix(1:10000, ncol = 10, dimnames = list(NULL, LETTERS[1:10]))) utils::head(M) # makes more sense than print(M, max = 1000) # prints 90 rows and a message about omitting 910 </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>