[R] Importing STATA files

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Jul 12 17:27:05 CEST 2001


"McElroy, Brendan" <BMcElroy at economics.ucc.ie> writes:

> 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

Needed quotes.

> 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
> avail.

Needed forward slashes or doubled backslashes.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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