print                  package:base                  R Documentation

_P_r_i_n_t _V_a_l_u_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'print' prints its argument and returns it _invisibly_ (via
     'invisible(x)').  It is a generic function which means that new
     printing methods can be easily added for new 'class'es.

_U_s_a_g_e:

     print(x, ...)

     ## S3 method for class 'factor':
     print(x, quote = FALSE, max.levels = NULL,
           width = getOption("width"), ...)

     ## S3 method for class 'table':
     print(x, digits = getOption("digits"), quote = FALSE,
           na.print = "", zero.print = "0", justify = "none", ...)

_A_r_g_u_m_e_n_t_s:

       x: an object used to select a method.

     ...: further arguments passed to or from other methods.

   quote: logical, indicating whether or not strings should be printed
          with surrounding quotes.

max.levels: integer, indicating how many levels should be printed for a
          factor; if '0', no extra "Levels" line will be printed.  The
          default, 'NULL', entails choosing 'max.levels' such that the
          levels print on one line of width 'width'.

   width: only used when 'max.levels' is NULL, see above.

  digits: minimal number of _significant_ digits, see 'print.default'.

na.print: character string (or 'NULL') indicating 'NA' values in
          printed output, see 'print.default'.

zero.print: character specifying how zeros ('0') should be printed; for
          sparse tables, using '"."' can produce stronger results.

 justify: character indicating if strings should left- or
          right-justified or left alone, passed to 'format'.

_D_e_t_a_i_l_s:

     The default method, 'print.default' has its own help page. Use
     'methods("print")' to get all the methods for the 'print' generic.

     'print.factor' allows some customization and is used for printing
     'ordered' factors as well.

     'print.table' for printing 'table's allows other customization.

     See 'noquote' as an example of a class whose main purpose is a
     specific 'print' method.

_R_e_f_e_r_e_n_c_e_s:

     Chambers, J. M. and Hastie, T. J. (1992) _Statistical Models in
     S._ Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     The default method 'print.default', and help for the methods
     above; further 'options', 'noquote'.

     For more customizable (but cumbersome) printing, see 'cat',
     'format' or also 'write'.

_E_x_a_m_p_l_e_s:

     require(stats)

     ts(1:20)#-- print is the "Default function" --> print.ts(.) is called
     rr <- for(i in 1:3) print(1:i)
     rr

     ## Printing of factors
     attenu$station ## 117 levels -> 'max.levels' depending on width

     ## ordered factors: levels  "l1 < l2 < .."
     esoph$agegp[1:12]
     esoph$alcgp[1:12]

     ## Printing of sparse (contingency) tables
     set.seed(521)
     t1 <- round(abs(rt(200, df=1.8)))
     t2 <- round(abs(rt(200, df=1.4)))
     table(t1,t2) # simple
     print(table(t1,t2), zero.print = ".")# nicer to read

