[R] Can anyone help??

Wittner, Ben, Ph.D. Wittner.Ben at mgh.harvard.edu
Wed Jan 16 19:44:11 CET 2008


The problem is that the backslash character (i.e., the "\" in "C:\online") is
used to separate folder names on MS Windows, but it's used for something else in
R.

Try
survey <- read.csv(file=file.path("C:", "onlinesurvey.csv"), head= TRUE, sep
=",")

-Ben

p.s., As the posting guide instructs, please try to make your subject lines more
descriptive than "help" or "error".

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of hoogeebear
> Sent: Wednesday, January 16, 2008 1:35 PM
> To: r-help at r-project.org
> Subject: [R] Can anyone help??
> 
> 
> Hi,
> 
> Im getting the following error when I attempt to read a csv file into R. I
> have the file saved on my C drive. Id really appreciate it if anyone can
> help....
> 
> My Command:
> 
> > survey <- read.csv (file = "C:\onlinesurvey.csv",head= TRUE, sep =",")
> 
> Error:
> 
> Error in file(file, "r") : unable to open connection
> 
> In addition: Warning messages:
> 1: '\o' is an unrecognized escape in a character string
> 2: unrecognized escape removed from "C:\onlinesurvey.csv"
> 3: In file(file, "r") :
>   cannot open file 'C:onlinesurvey.csv', reason 'No such file or
> directory'
> 
> I have the file located on the C drive so I do not know why its telling me
> "no such file or directiry".
> --
> View this message in context: http://www.nabble.com/Can-anyone-help---
> tp14888245p14888245.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.




More information about the R-help mailing list