[Rd] write.csv

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Nov 24 17:14:56 CET 2005

On Thu, 2005-11-24 at 17:00 +0100, Sven Schaltenbrand wrote:
> hallo,
> i have a problem by writing a csv file
> the first colum is filled with index numbers from 1 to n.
> i have to unique two csv files once a week while one file is always the
> same.
> can anybody tell me, how to write the dataset into a csv file without the
> first row of the indexnumbers.
> x[,-1] does not wok as it eliminates the first "interesting" colum.
> col.names is not accepted by r (do i habe to start a package first? which
> one?)
> thx
> sven
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

This isn't a R-Devel related question, it would have been better sent to


Also, you are asked to read the docs for the functions you are having
problems with. The answer is in ?write.csv and the argument row.names.
Setting this to FALSE gives you your desired behaviour, e.g.:

> ?write.csv
> data(iris) #example data
> write.csv(iris, row.names = FALSE)
> write.csv(iris, row.names = TRUE)

As I didn't specify a filename as the file argument, the results are
displayed at the console.


Gavin Simpson                     [T] +44 (0)20 7679 5522
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.

More information about the R-devel mailing list