[R] read.table with spaces

Robert W. Baer, Ph.D. rbaer at atsu.edu
Fri Feb 20 15:38:25 CET 2004


You should make your missing value indicator something other than your
separator indicator:
1.  Use a text editor to indicate all missing values as NA     or
2.  Use a text editor to replace the 3 separator spaces with, for example, a
comma or semicolon and use the argument sep="," or sep=";" which won't
trigger on ANY whitespace.

HTH,
Rob

----- Original Message ----- 
From: "AGUSTIN PEREZ MARTIN" <agustin.perez at alu.umh.es>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, February 20, 2004 8:01 AM
Subject: [R] read.table with spaces


> DeaR useRs:
>
> Excuses for my english. I am trying to read a file with my dats and the
format is a number, 3 spaces, other number, etc...
> When I use:
> a<-read.table(file="c:/datos2.dat",sep="")
> R sais:
> Error in scan(file = file, what = what, sep = sep, quote = quote, dec =
dec,  :
>         line 3 did not have 34 elements
>
> And I see my dats and in line 3 the first number is an space (missing
value)
> SOS help me!!!!
>
> Thanks.
>
> --
>
> ==============oOo=============
> Visit my website in:
> http://users.servicios.retecal.es/aperez2
> Maybe you can find something interesting
> ==============================
> --
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list