[R] Importing file from Excel

Martin Maechler maechler at stat.math.ethz.ch
Mon Aug 27 09:27:54 CEST 2001


>>>>> "srinivas" == srinivasa raghavan <sristatistician at yahoo.com> writes:

    srinivas> Hi, I have a basic import problem. I tried to import a comma
    srinivas> delimited "boston.csv" from C drive and gave the following
    srinivas> command at R prompt

    >> read.csv(c:\boston.csv,sep=",",dec=".",fill=TRUE)
    srinivas> Error: syntax error

    srinivas> can any one help to debugg the code.I am using R version 1.3
    srinivas> for windows

The syntax error is because you didn't quote the file name, and ":" , "\"
will give problems.
But even with quotes that wouldn't work directly: Note that "\" is the
escape character (used, e.g. in "\n" which is newline) and hence would have
to be doubled.
The `real' recommendation otoh is to use real slashes instead of windoze
ones :

     read.csv("c:/boston.csv", sep=",", dec=".", fill=TRUE)
                 ^

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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