Skip to content

read.table with spaces

2 messages · AGUSTIN PEREZ MARTIN, Robert Baer

#
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
==============================
--
#
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
format is a number, 3 spaces, other number, etc...
dec,  :
value)
http://www.R-project.org/posting-guide.html