[R] Re: Use of the Foreign package to import Stata files

Alan Cobo-Lewis alanc at umit.maine.edu
Tue Oct 7 15:46:55 CEST 2003


Regarding an old version of foreign allegedly being able to read the file at
http://www.ats.ucla.edu/stat/stata/examples/rwg/concord1.dta
Thomas Lumley <tlumley at u.washington.edu> responded to my call for help:
>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 Lumley <tlumley at u.washington.edu> continued:
>I just found an old 1.6.2 (Mac OS/Darwin) lying around and it doesn't
>recognize the file as a stata file (with foreign 0.5-8)

Thomas,

My apologies. It turns out that using R 1.6.2 and an old foreign library, I *can't* read the concord1.dta file at that url, though I *can* read a concord1.dta file that I'd downloaded several months ago. So either the archive at www.ats.ucla.edu
overwrote good files with bad, or maybe their site doesn't match an alternate source for the same data files. Either way, I'm sorry to have sent you on a wild goose chase. The error was not in your package. Thank you for your prompt replies.

alan

--
Alan B. Cobo-Lewis, Ph.D.		(207) 581-3840 tel
Department of Psychology		(207) 581-6128 fax
University of Maine
Orono, ME 04469-5742     		alanc at maine.edu

http://www.umaine.edu/visualperception




More information about the R-help mailing list