Dear Peter, Also thank you for your quick reply. I did the following with no positive result:
library(foreign) read.dta(choose.file(C:\Rklein)) Error: unexpected input in "read.dta(choose.file(C:\" > read.dta(choose.file("C:\Rklein")) Error in grep("^(http|ftp|https)://", file) : could not find function "choose.file" In addition: Warning messages: 1: '\R' is an unrecognized escape in a character string 2: unrecognized escape removed from "C:\Rklein" The Rklein file is indeed .dta. So what is the next step I can do? Best regards, Rob Bakker 2009/4/24 Peter Dalgaard <p.dalga...@biostat.ku.dk> > Jim Lemon wrote: > > Rob Bakker wrote: > >> Dear Sirs, > >> I am just starting with R and I think it is a great system. Now, I > >> want to > >> import Stata datasets (.dta) with read.dta, but receive errormessages > >> like: > >> > >> Error in grep("^(http|ftp|https)://", file) : object "Rklein" not found > >> > >> Error in read.dta("Rklein") : > >> unable to open file: 'No such file or directory' > >> this happens when I use "" > >> > >> What is the problem and how can I solve it? > >> > > Hi Rob, > > Looks like you're on Windows, and you have probably fallen victim to the > > Microsoft (and Apple) "hide-everything-you-can-from-them" file manager > > defaults. Your file "Rklein" probably has an extension on it (maybe > > .dta?) and if you can find that by turning off extension hiding, you > > will probably see the solution immediately. > > > > Jim > > Also, notice the function choose.file() which lets browse your way to > the file in the usual Windows style. If used on its own, then it returns > the full path to the file, so that you know what to feed to read.dta(). > > You can short-circuit by using read.dta(choose.file()), but if you do it > in a script, then you need to do the browsing every time you run the > script. > > -- > O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B > c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 > > [[alternative HTML version deleted]]
______________________________________________ R-help@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.