title: Most efficient way of exporting large (3.9 mill obs) data.frames to text file?
body: <p>I have a fairly large dataframe in R that I would like to export to SPSS. 
  This file has caused me hours of headaches trying to import it to R in the first place, however I got successful using <code>read.fwf()</code> using the options <code>comment.char="%"</code> (a character not appearing in the file) and <code>fill= TRUE</code>(it was a fixed-width ASCII file with some rows lacking all variables, causing error messages).</p>
  
  <p>Anyway, my data frame currently consists of 3,9 mill observations and 48 variables (all character). I can write it to file fairly quickly by splitting it into 4 x 1 mill obs sets with <code>df2 &lt;- df[1:1000000,]</code> followed by <code>write.table(df2)</code> etc., but can't write the entire file in one sweep without the computer locking up and needing a hard reset to come back up. </p>
  
  <p>After hearing anecdotal stories about how R is unsuited for large datasets for years, this is the first time I have actually encountered a problem of this kind. I wonder whether there are other approaches(low-level "dumping" the file directly to disk?) or whether there is some package unknown to me that can handle export of large files of this type efficiently?</p>