[R] Importing STATA files

McElroy, Brendan BMcElroy at economics.ucc.ie
Thu Jul 12 17:09:09 CEST 2001

I'm an R novice who is struggling with the importation STATA files into R.

I've loaded "foreign" and tried the example based on the Swiss file, which
works fine.  I then placed a STATA file, auto6.dta, in my working directory,
which is "C:\Program Files\R\rw1030\library\base\data".

The following is what happened:

> library(foreign)
> read.dta(auto6)
Error in read.dta(auto6) : Object "auto6" not found

So I tried:
> read.dta("C:\Program Files\R\rw1030\library\base\data\auto6")
Error in read.dta("C:Program FilesR\rw1030library\basedata") : 
        unable to open file

The same thing happens if I put the STATA file in various other directories
that I suspect "foreign" might treat as the working directory, all to no

Any help would be gratefully received.

Brendan McElroy
HRB Health Services Research Fellow
Departments of Economics and General Practice
University College Cork

Tel: + 353 21 490 3522
Fax: + 353 21 427 3920

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list