[R] Reading data with blank elements
philipp.pagel.lists at t-online.de
Fri Jul 21 15:34:36 CEST 2006
On Fri, Jul 21, 2006 at 05:43:03AM -0700, Ahamarshan jn wrote:
> I have a dataset saved in *.csv format, that contains
> Error in scan (file = file, what = what, sep = sep,
> quote = quote, dec = dec, :
> line 1919 did not have 13 elements
> Execution halted "
R does handle empty elements fine. The error message you quote occurs if
a row does not contain the expected number of elements (empty or not.)
Did you have a look at row 1919? Does it really contain the same number
of separators (commas) as the other ones?
Some programs handle empty elements at the end of a row in a 'lazy' way
and simply ommit them. If this is the case you can use the option
'fill=TRUE' to tell read.table that you want it to silently pad short
rows with empty elements.
Another 'popular' reason for funny errors with read.table is the
unexpected occurence of quotation or comment characters in the data...
Dr. Philipp Pagel Tel. +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany
Institute for Bioinformatics / MIPS Tel. +49-89-3187 3675
GSF - National Research Center Fax. +49-89-3187 3585
for Environment and Health
Ingolstädter Landstrasse 1
85764 Neuherberg, Germany
More information about the R-help