An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090424/f9f968b7/attachment-0001.pl>
stata ==> R - error messages
9 messages · Jim Lemon, Peter Dalgaard, Rob Bakker +2 more
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
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.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090424/1ce13aa8/attachment-0001.pl>
On 24/04/2009 7:42 AM, Peter Dalgaard wrote:
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 function name is actually file.choose(), which exists on all (?) platforms. There's also a function choose.files(), only on Windows, and mainly used for choosing multiple files (but it has a few other Windows-only differences from file.choose()). Duncan Murdoch
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.
Rob Bakker wrote:
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"
As Duncan points out, it is file.choose(), sorry about that - I don't use Windows regularly. Notice also that you need to run it _without_ any argument.
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.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090424/9e8466e9/attachment-0001.pl>
On Fri, Apr 24, 2009 at 01:50:04PM +0200, Rob Bakker wrote:
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))
a) quote the filename
b) include the suffix
rklein <- read.dta("C:\Rklein.dta")
Hans Ekbrand (http://sociologi.cjb.net) <hans at sociologi.cjb.net> GPG Fingerprint: 1408 C8D5 1E7D 4C9C C27E 014F 7C2C 872A 7050 614E -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090424/f8fcb5a8/attachment-0002.bin>
On 4/24/2009 10:18 AM, Hans Ekbrand wrote:
On Fri, Apr 24, 2009 at 01:50:04PM +0200, Rob Bakker wrote:
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))
a) quote the filename
b) include the suffix
rklein <- read.dta("C:\Rklein.dta")
c) use forward slashes, or double backslashes:
rklein <- read.dta("C:/Rklein.dta")
Duncan Murdoch