write.foreign            package:foreign            R Documentation

_W_r_i_t_e _t_e_x_t _f_i_l_e_s _a_n_d _c_o_d_e _t_o _r_e_a_d _t_h_e_m.

_D_e_s_c_r_i_p_t_i_o_n:

     This function exports data frames to other statistical packages by
     writing the data as free-format text and writing a separate file
     of instructions for the other package to read the data.

_U_s_a_g_e:

     write.foreign(df, datafile, codefile, package = c("SPSS","Stata"), ...)

_A_r_g_u_m_e_n_t_s:

      df: A data frame

datafile: Name of file for data output

codefile: Name of file for code output

 package: Name of package

     ...: Other arguments for the individual 'writeForeign' functions

_D_e_t_a_i_l_s:

     The work for this function is done by
     'foreign:::writeForeignStata' and 'foreign:::writeForeignSPSS'. To
     add support for another package, eg SAS, create a function
     'writeForeignSAS' with the same first three arguments as
     'write.foreign'. This will be called from 'write.foreign' when
     'package="SAS"'.

_V_a_l_u_e:

     None

_A_u_t_h_o_r(_s):

     Thomas Lumley

_E_x_a_m_p_l_e_s:

     ## Not run: 
     datafile<-tempfile()
     codefile<-tempfile()
     write.foreign(esoph,datafile,codefile,package="SPSS")
     file.show(datafile)
     file.show(codefile)
     unlink(datafile)
     unlink(codefile)
     ## End(Not run)

