print.default              package:base              R Documentation

_D_e_f_a_u_l_t _P_r_i_n_t_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     'print.default' is the _default_ method of the generic 'print'
     function which prints its argument.

_U_s_a_g_e:

     ## Default S3 method:
     print(x, digits = NULL, quote = TRUE,
           na.print = NULL, print.gap = NULL, right = FALSE,
           max = NULL, useSource = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

       x: the object to be printed.

  digits: a non-null value for 'digits' specifies the minimum number of
          significant digits to be printed in values.  The default,
          'NULL', uses 'getOption(digits)'.  (For the interpretation
          for complex numbers see 'signif'.) Non-integer values will be
          rounded down, and only values greater than or equal to 1 and
          no greater than 22 are accepted. 

   quote: logical, indicating whether or not strings ('character's)
          should be printed with surrounding quotes.

na.print: a character string which is used to indicate 'NA' values in
          printed output, or 'NULL' (see 'Details').

print.gap: a non-negative integer <= 1024, or 'NULL' (meaning 1),
          giving the spacing between adjacent columns in printed
          vectors, matrices and arrays.

   right: logical, indicating whether or not strings should be right
          aligned.  The default is left alignment.

     max: a non-null value for 'max' specifies the approximate maximum
          number of entries to be printed.  The default, 'NULL', uses
          'getOption(max.print)'; see that help page for more details.

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.

_D_e_t_a_i_l_s:

     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.

     When the 'methods' package is attached, 'print' will call 'show'
     for R objects with formal classes if called with no optional
     arguments.

_W_a_r_n_i_n_g:

     Using too large a value of 'digits' may lead to representation
     errors in the calculation of the number of significant digits and
     the decimal representation: these are likely for 'digits >= 16',
     and these possible errors are taken into account in assessing the
     numher of significant digits to be printed in that case.

     Whereas earlier versions of R might have printed further digits
     for 'digits >= 16' on some platforms, they were not necessarily
     reliable.

_S_i_n_g_l_e-_b_y_t_e _l_o_c_a_l_e_s:

     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.

_U_n_i_c_o_d_e _a_n_d _o_t_h_e_r _m_u_l_t_i-_b_y_t_e _l_o_c_a_l_e_s:

     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 the Unicode point, a
     warning is issued.  The only known exceptions are certain Japanese
     ISO2022 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.)

_S_e_e _A_l_s_o:

     The generic 'print', 'options'. The '"noquote"' class and print
     method.

     'encodeString', which encodes a character vector the way it would
     be printed.

_E_x_a_m_p_l_e_s:

     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

