From: Jason Turner (jasont@indigoindustrial.co.nz)
Date: Sun 01 Apr 2001 - 13:19:53 EST
Message-ID: <20010401151953.A5623@camille.indigoindustrial.co.nz>
> I tried to read the table bellow (table goes on with 54 rows) with
> the read.table
...
>
> What "length" is the error message referring to?
The number of columns in each row. Apparently, it was different in
at least two rows.
Possible causes:
1) repeated tabs, when there should've been one only. From the
format of the data you provided, this looks possible. With \t
representing a tab, R will interpret "3\t\t7" as a 3, two
separators, with a non-value between them (NA), and a 7 rather
than 3, separator, 7. If you're comfortable with vi, you can find
these in your file by ":s/\t\t" (without the quotes, of course).
grep gets confused on my system between \t being a "t" and
a tab. If you're certain that there are no deliberately blank
entries (check this!), you can remove repeated tabs inside vi with
:1,$s,\t\t*,\t,g
2) trailing tabs. Again, from within vi, you can clean these
up by
:1,$s,[\t ]*,,
which clears trailing spaces and tabs.
I usually leave a few perl, awk, or sed scripts lying around
just for such tidy-ups (plus empty lines, leading spaces, and
other annoyances). Keeps me from having to remember all the
things that have bitten me before.
Cheers
Jason
-- Indigo Industrial Controls Ltd. 64-21-343-545 jasont@indigoindustrial.co.nz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2b30 : Fri 22 Jun 2001 - 18:58:38 EST