[R] importing from Stata

Dimitri Joe dimitrijoe at gmail.com
Mon Jan 16 22:29:43 CET 2006


Hi,

I have a new job, and everyone here uses Stata. I won't give up on R, 
but I must learn better how to exchange data between the two softwares. 
I am now focusing on importing data from Stata to R, and I must confess 
that I am a bit disappointed with the read.dta function from the foreign 
package because IT typically happens that

(i) I get a big R file (for example, a 15Mb Stata file became a 42Mb R 
file; after cleanup.import() from the Hmisc package, it drooped to 35Mb, 
but that's still more than 2x the original Stata file) which, in turn, I 
suspect is due the fact that

(ii) factors are created using Stata labels as levels.

I wonder if

(i) there isn't a way of forcing each variable to be numeric or integer, 
maintaining it's original values (instead of "Stata labels" as "R 
levels"). Or,

(ii) some one has written another function/s to carry this task.

I'd appreciate any suggestions on how to import from Stata to R more 
efficiently.
Thanks in advance,

Dimitri




More information about the R-help mailing list