[R] large dataframes to ascii

Ott Toomet siim at obs.ee
Thu Oct 11 12:31:55 CEST 2001


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 C-function
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

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list