[R] read.dta error

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 29 14:05:30 CEST 2008


For the record, my guess was correct -- it was the result of an error in 
the Stata docmentation for version 10 (format 114) files.  They have 
changed the length of the fmtlist field, but only changed some parts of 
the documentation.

So it only affected Stata 10 files, and it did work correctly (where 
allowed to) since all that happened was that a neighbouring string 
variable was overwritten.  Thanks to Aleksandr for the example.

This (and several other Stata 10 issues) is fixed in foreign 0.8-26 now on 
CRAN.

On Tue, 27 May 2008, Prof Brian Ripley wrote:

> You haven't followed the posting guide -- no OS, version of R, version of 
> foreign.  (This is fairly clearly Linux, but we need the architecture as such 
> errors are often confined to one architecture.)
>
> But most importantly, no reproducible example.
>
> This probably indicates an infelicity in the do_readStata code, but without a 
> reproducible example we will be unable to fix it.  (It might be an error in 
> the foreign package, but it would not be the first time that it was an error 
> in the description of the Stata format.)
>
> On Mon, 26 May 2008, Aleksandr Andreev wrote:
>
>> Greetings!
>> 
>> I attempted to read a STATA 10 file using the following syntax:
>> 
>> library(foreign)
>> data <- read.dta("~/Documents/agestandard/analysis.dta")
>> 
>> I got the following error:
>> 
>> *** stack smashing detected ***: /usr/lib/R/bin/exec/R terminated
>> ======= Backtrace: =========
>> /lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7c13138]
>> /lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x0)[0xb7c130f0]
>> /usr/local/lib/R/site-library/foreign/libs/foreign.so[0xb759c164]
>> /usr/local/lib/R/site-library/foreign/libs/foreign.so(do_readStata+0x0)[0xb759c060]
>> [0x0]
>
> ...
>
>> Does anyone have any ideas?
>> 
>> Aleks
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
>
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list