[R] Unable to re-import a table that was just exported to a file

Berwin A Turlach berwin at maths.uwa.edu.au
Mon Apr 27 13:32:30 CEST 2009


On Sun, Apr 26, 2009 at 7:38 PM, Nigel Birney <nan23 at cam.ac.uk> wrote:
>
> Hi all,
>
> I am saving a program's output to a file to be read by another
> algorithm. But somehow such a simple operation (the reading) fails.
> I get:
>
> Error in read.table("a_corr_data.txt", sep = ",", col.names = T,
> row.names = F) :
> __more columns than column names
>
>
> Here is the write statement:
>
> write.table(a_corr_data,"a_corr_data.txt",sep=",",col.names=T,row.names=F)
>
> Here is the read statement:
>
> a_corr_data <-
> read.table("a_corr_data.txt",sep=",",col.names=T,row.names=F)
>
> Nothing happens in-between (these actions are just 10-30 secs
> apart). I tried to export/import without col.names, also tried
> different deliminators ("/t") but the same error pops up again and
> again. I am already quite unhappy with this.

?read.table

You might find that you are using col.names and row.names wrongly in the
read.table command.

Best wishes,

	Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability        +65 6516 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba




More information about the R-help mailing list