[R] problems with read.table
Martin Maechler
maechler at stat.math.ethz.ch
Wed Feb 10 10:35:46 CET 1999
>>>>> "Peter" == Peter Holzer <holzer at stat.math.ethz.ch> writes:
Peter> Dear R users, I have the following problem: I have a table in
Peter> ASCII-format, separated with commas. I can read it as long as no
Peter> field contains a comma itself. If one does, read.table doesn't
Peter> function even though that field is double-quoted.
Peter> Ex.:
Peter> File "test.csv":
Peter> Name,Strasse,PLZ
Peter> Jsaac,Gossauerstrassee 29,9100
Peter> Roth-Bernasconi,"20, ch. des Fauvettes",1212
One possibility:
Change the last line to
Roth-Bernasconi,20\, ch. des Fauvettes,1212
^^
i.e., espape the "," (and don't use the " double quotes).
However, this is not always a feasible solution.
Peter> adressen <- read.table("test.csv", header=T, sep=",")
Peter> results in an error as the comma in "20, ch. des Fauvettes" is
Peter> interpreted as a field delimiter. Playing around with read.table
Peter> and also with scan I found out that double-quotes are always
Peter> interpreted as characters of their own.
Peter> What can I do? Thanks for any help.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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