Re: [R] error in saved .csv

From: Peter Langfelder <>
Date: Tue, 01 Mar 2011 14:24:28 -0800

On Tue, Mar 1, 2011 at 1:36 PM, Tamas Barjak <> wrote:
> Help me please!
> I would like to be saved a data table:
> write.csv(random.t1, "place", dec=",", append = T, quote = FALSE, sep = " ",
> qmethod = "double", eol = "\n", row.names=F)
> It's OK!
> But the rows of file

>  1,1,21042,-4084.87179487179,2457.66483516483,-582.275562799881
> 2,2,23846,-6383.86480186479,-3409.98451548449,-3569.72145340269
> and no
> 1
> 21042 -         4084.87179487179 2457.66483516483
> Not proportional...
> What's the problem???

If I understand you correctly, you want a text file where the separator is a white space. You cannot get that with write.csv - you have to use write.table(). The function write.csv does not allow you to change the sep argument. Here's what the help file says:

 ‘write.csv’ and ‘write.csv2’ provide convenience wrappers for

     writing CSV files.  They set ‘sep’, ‘dec’ and ‘qmethod’, and
     ‘col.names’ to ‘NA’ if ‘row.names = TRUE’ and ‘TRUE’ otherwise.

     ‘write.csv’ uses ‘"."’ for the decimal point and a comma for the

     ‘write.csv2’ uses a comma for the decimal point and a semicolon
     for the separator, the Excel convention for CSV files in some
     Western European locales.

     These wrappers are deliberately inflexible: they are designed to
     ensure that the correct conventions are used to write a valid
     file.  Attempts to change ‘append’, ‘col.names’, ‘sep’, ‘dec’ or
     ‘qmethod’ are ignored, with a warning.

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 01 Mar 2011 - 22:28:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Mar 2011 - 22:50:18 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive