[R] read.table
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri May 17 10:30:53 CEST 2002
"juli g. pausas" wrote:
>
> Hi,
> I have a data file with columns separated by ";" I read this file
> without any problem using read.csv2( ) but I had problems trying to read
> it with read.table( ... sep=";"). So it is not a problem for me, but I
> wonder if there is a bug here.
>
> drt <- read.csv2("t.txt", header=TRUE) # ok
> dcs <- read.table("t.txt", header=TRUE, sep=";") # wrong
>
> R.1.5.0. on Windows
That's not a bug!
It's because of the different defaults of quote (there's a "'" in line
17).
You can use e.g.
read.table("t.txt", header=TRUE, sep=";", quote="\"")
Uwe Ligges
> the file t.txt:
>
> codi;long;lat;alt;prov;nom
> 8002;-0.65;38.72;816;A;BANYERES
> 8003;-0.77;38.70;592;A;BENEIXAMA
> 8003A;-0.78;38.70;580;A;BENEIXAMA, AGROMET
> 8004;-0.77;38.63;754;A;BIAR, CASA PORSELL
> 8005;-0.95;38.77;644;A;VILLENA, LA ENCINA
> 8006;-0.98;38.70;557;AB;CAUDETE, DERRAMADOR
> 8006I;-0.92;38.68;515;A;VILLENA, LA VEREDA
> 8007;-0.87;38.63;505;A;VILLENA
> 8009E;-0.87;38.47;560;A;MONOVER, EL ESVARADOR
> 8010;-0.77;38.48;562;A;PETRER
> 8011;-0.78;38.48;395;A;ELDA
> 8013;-0.77;38.38;241;A;NOVELDA
> 8014O;-0.97;38.42;555;A;XINORLET
> 8015O;-0.88;38.37;500;A;LA ROMANA, AGROMET
> 8018B;-0.70;38.27;86;A;ELX, CHS
> 8019;-0.55;38.28;31;A;ALACANT, L'ALTET
> 8024;-0.52;38.37;60;A;ALACANT, LA RABASA
>
> Perphas the problem is that the last column have commas ...
> So I'm not sure if this is a feature or a bug.
>
> juli
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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