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","SAS"), ...)

_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', 'foreign:::writeForeignSAS' and
     'foreign:::writeForeignSPSS'. To add support for another package,
     eg Systat, create a function 'writeForeignSystat' with the same
     first three arguments as 'write.foreign'. This will be called from
     'write.foreign' when 'package="Systat"'.

     For 'package="SAS"' there is an optional argument
     'dataname="rdata"' taking a string that will be the SAS data set
     name.

_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)

