[R] Re: Use of the Foreign package to import Stata files
Thomas Lumley
tlumley at u.washington.edu
Mon Oct 6 23:58:35 CEST 2003
On Mon, 6 Oct 2003, Alan Cobo-Lewis wrote:
>
> But sometimes older works better than newer. The read.dta() function in
> R 1.7.0's foreign package (package 0.6-3) fails to recognize as a Stata
> file what seems to be a genuine Stata file, even though R 1.6.2's
> foreign package (package 0.5-9) imports the same file just work fine.
> Using R 1.7 and rolling the package back to foreign 0.5 doesn't seem to
> fix the problem (haven't been able to roll R1.7 all the way back to
> foreign 0.5-9 yet, just to a newer 0.5 whose binary is still posted on
> cran).
>
> An example of such a Stata file it at
> http://www.ats.ucla.edu/stat/stata/examples/rwg/concord1.dta
>
I don't know why it used to work. The file begins with 'h' (0x68), which
isn't in my list of valid Stata file types. On the other hand, Stata has
no problem with it. It's possible that it is a version 4 file (which
would make sense, since version 5 file start with 'i' and increase from
there) but that wouldn't explain why it used to work.
With the stataread package (which predates 0.5-x of foreign) I get "Not a
Stata version 5-7 data file".
-thomas
More information about the R-help
mailing list