cat                   package:base                   R Documentation

_C_o_n_c_a_t_e_n_a_t_e _a_n_d _P_r_i_n_t

_D_e_s_c_r_i_p_t_i_o_n:

     Prints the arguments, coercing them if necessary to character mode
     first.

_U_s_a_g_e:

     cat(... , file = "", sep = " ", fill = FALSE, labels = NULL,
         append = FALSE)

_A_r_g_u_m_e_n_t_s:

     ...: R objects which are coerced to character strings,
          concatenated, and printed, with the remaining arguments
          controlling the output.

    file: A connection, or a character string naming the file to print
          to.  If '""' (the default), 'cat' prints to the standard
          output connection, the console unless redirected by 'sink'.
          If it is '"|cmd"', the output is piped to the command given
          by 'cmd', by opening a pipe connection. 

     sep: character string to insert between the objects to print.

    fill: a logical or numeric controlling how the output is broken
          into successive lines.  If 'FALSE' (default), only newlines
          created explicitly by '\n' are printed.  Otherwise, the
          output is broken into lines with print width equal to the
          option 'width' if 'fill' is 'TRUE', or the value of 'fill' if
          this is numeric.

  labels: character vector of labels for the lines printed. Ignored if
          'fill' is 'FALSE'.

  append: logical. Only used if the argument 'file' is the name of file
          (and not a connection or '"|cmd"'). If 'TRUE' output will be
          appended to 'file'; otherwise, it will overwrite the contents
          of 'file'.

_D_e_t_a_i_l_s:

     'cat' converts its arguments to character strings, concatenates
     them, separating them by the given 'sep=' string, and then prints
     them.

     No linefeeds are printed unless explicitly requested by '\n' or if
     generated by filling (if argument 'fill' is 'TRUE' or numeric.)

     'cat' is useful for producing output in user-defined functions.

_V_a_l_u_e:

     None (invisible 'NULL').

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'print', 'format', and 'paste' which concatenates into a string.

_E_x_a_m_p_l_e_s:

     iter <- rpois(1, lambda=10)
     ## print an informative message
     cat("iteration = ", iter <- iter + 1, "\n")

     ## 'fill' and label lines:
     cat(paste(letters, 100* 1:26), fill = TRUE,
         labels = paste("{",1:10,"}:",sep=""))

