

write {base}                                 R Documentation

_W_r_i_t_e _D_a_t_a _t_o _a _F_i_l_e

_D_e_s_c_r_i_p_t_i_o_n_:

     The data (usually a matrix) `x' are written to file
     `file'.  If `x' is a two dimensional matrix you need to
     transpose it to get the columns in `file' the same as
     those in the internal representation.

_U_s_a_g_e_:

     write(x, file="data",
             ncolumns=if(is.character(x)) 1 else 5,
             append=FALSE)

_A_r_g_u_m_e_n_t_s_:

       x: the data to be written out.

    file: the name of the file (quoted) to write to.

ncolumns: the number of columns to write the data in.

  append: if `TRUE' the data `x' is appended to file `file'.

_S_e_e _A_l_s_o_:

     `scan' for reading data.

_E_x_a_m_p_l_e_s_:

     # create a 2 by 5 matrix
     x <- matrix(1:10,ncol=5)

     # the file data contains x, two rows, five cols
     # 1 3 5 6 9 will form the first row
     write(t(x))

     # the file data now contains the data in x,
     # two rows, five cols but the first row is 1 2 3 4 5
     write(x)

