sink                  package:base                  R Documentation

_S_e_n_d _R _O_u_t_p_u_t _t_o _a _F_i_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Diverts all R output to `file', overwriting the file unless
     `append' is `TRUE'.

_U_s_a_g_e:

     sink(file = NULL, append = FALSE)

_A_r_g_u_m_e_n_t_s:

    file: a connection or a character string naming the file to write
          to, or `NULL' to stop ``sink''ing.

  append: if `TRUE', output will be appended to `file'; otherwise, it
          will overwrite the contents of `file'.

_D_e_t_a_i_l_s:

     Only prompts and error messages continue to appear on the
     terminal.

     `sink()' or `sink(file=NULL)' ends the diversion.

     If `file' is a connection if will be opened if necessary.
     Switching to another file or connection closes and destroys the
     current sink connection if it is a file connection opened by the
     last call to `sink'.

_E_x_a_m_p_l_e_s:

     sink("sink-examp.txt")
     i <- 1:10
     outer(i,i,"*")
     sink()
     unlink("sink-examp.txt")

