[Rd] read.table error upon package installation (PR#8230)

McGehee, Robert Robert.McGehee at geodecapital.com
Fri Oct 21 15:21:51 CEST 2005


Thanks for this. 

I tried switching the file extension from txt to tab, but it seems to
still split on whitespace rather than tabs.

My goal is to create a file that is both readable by R and by a
spreadsheet program, and that may contain white spaces. If tab-delimited
separation is not currently supported on load time, a CSV file would
also be a natural candidate. Unfortunately for me, it seems that R
expects the CSV file in the 'data' subdirectory to be delimited by
semi-colons rather than commas (which seems odd and might be worthy of
mention in the Writing R Extensions Manual), and the particular
spread-sheet program I use uses commas to delimit CSV files. So, then, I
think that I will be unable to use 'data' subdirectory to load this data
using data(), but any feedback on this is welcomed.

Thanks,
Robert


-----Original Message-----
From: ripley at stats.ox.ac.uk [mailto:ripley at stats.ox.ac.uk] 
Sent: Friday, October 21, 2005 1:58 AM
To: r-devel at stat.math.ethz.ch
Cc: R-bugs at biostat.ku.dk
Subject: Re: [Rd] read.table error upon package installation (PR#8230)


What is the R error here?

The default delimiter in read.table is not \t but whitespace, so the
first 
example has 2 and 3 rows (fine for header=T) and the second has 2 and 4 
rows.

On Fri, 21 Oct 2005 Robert.McGehee at geodecapital.com wrote:

> Upon upgrading to R 2.2.0 on my Windows box, I found that one of my
> packages no longer compiled, giving this error:
>
> Error in read.table(zfile, header =3D TRUE) :
> 	more columns than column names
> Execution halted
>
> After removing every line of code from my package and still not being
> able to compile it, I found the error to be related to a .txt file in
my
> data directory. I reduced my data file to a very simple example which
> causes the error, and a nearly identical file which does not cause the
> problem.
>
> A file with these contents causes the error (I am using \t to indicate
> the usual tab delimiter).
> x	\t	y
> A B C	\t	DEF
>
> However, if I remove one of the spaces between A and B or B and C, the
> package compiles fine:
> x	\t	y
> A BC	\t	DEF
>
> I can only guess that there is some kind of parsing problem when there
> is more than one space between tab delimiters.

Looks more like a user misunderstanding of ?data.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list