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

2003-10-07 Thread Alan Cobo-Lewis

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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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[EMAIL PROTECTED]

http://www.umaine.edu/visualperception

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


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

2003-10-06 Thread Alan Cobo-Lewis
Long ago (Sat, 2 Nov 2002), Bill Hart [EMAIL PROTECTED] wrote: 
 An R newbie here. I am using R 1.6 currently and have 
 (successfully, I think) installed the Foreign package. 
 Tried to import a data file created with Stata 7.0 
 SE. Had minor problems with syntax then R decided 
 that my file was not really a Stata file. It rejected 
 the file saying 'Not created by Stata 5-7/SE'. Any 
 suggestions on how to convince R that this is really, 
 truly a Stata file? 
 
Thomas Lumley ([EMAIL PROTECTED]) responded:
 You need the version of read.dta that I wrote yesterday after finally 
 obtaining some 7/SE datasets for debugging. If you can compile packages 
 then I can send you the code, otherwise you will have to wait for the next 
 version of the foreign package. 

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

Does anyone have a hint or fix?

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[EMAIL PROTECTED]

http://www.umaine.edu/visualperception

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


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

2003-10-06 Thread Thomas Lumley
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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


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

2003-10-06 Thread Thomas Lumley
On Mon, 6 Oct 2003, Thomas Lumley wrote:

 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.

Are the data correct with 1.6.2? It's looking increasingly strange that
foreign ever read these data.  The file doesn't seem to have the timestamp
field that versions 5-8 include, which should mess up the reading of the
rest of the file.

-thomas

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


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

2003-10-06 Thread Thomas Lumley

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


On Mon, 6 Oct 2003, Thomas Lumley wrote:

 On Mon, 6 Oct 2003, Thomas Lumley wrote:

  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.

 Are the data correct with 1.6.2? It's looking increasingly strange that
 foreign ever read these data.  The file doesn't seem to have the timestamp
 field that versions 5-8 include, which should mess up the reading of the
 rest of the file.

   -thomas

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help