[R] large dataframes to ascii

Ortega Fernandez, Carlos (carlos) cof at agere.com
Thu Oct 11 14:24:51 CEST 2001


One alternative way to do that is by processing portions of your big table.

You can select, consecutive numbers of colums and rows and save them in
separate files that after finishing you can recompose on Linux with cat and
paste commands.

It is clearly more tedious but effective and manageable.

Hope it helps.
Carlos Ortega.

Hi R-users, 
I want to convert a large dataset (from stata format) to an ascii table. 
The resulting table should be a human-readable table (like CSV, or 
tab-separated file or something similar). R reads the stata-file quite 
easily (with some problems which are discussed here earlier), but so long I 
have not found a suitable way to write it in ascii format. 
Sure, there exists write.table, which is intended for that purpose. But the 
problem is that the table is quite a large (7500 obs x 1200 vars) and after 
half-an-hout processing on my PII wiht 128 MB memory, write.table stopped 
with a message that it could not allocate 35 MB more. 
dput() and save( ..., ascii=TRUE) work well but the result is not such a 
table I am looking for. I tried also print() with option( width=very wide) 
but the largest allowed with is 10000, the table should be around 30000 
characters wide. 
When I tried to write.table() line-by line, I got quite soon a message that 
R was killed. 
I know the write.table() pastes together all the variables and writes then 
the resulting string to the file. Aren't there any more efficient way of 
doing it, I think saving the dataframe variable-by-variable using a
should be quite a fast and not memory hungry at all. 
I have R 1.3.1 on RH7.1 linux 
Thanks in advance, 
Ott Toomet 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20011011/a5e32bed/attachment.html

More information about the R-help mailing list