[R] write.table column names shift

2009-09-04 Thread dennis11

Hi everyone,

I want to write some data to file, for example

a = c(1,2,3,4,5)
b = c(5,6,7,8,9)

write.table(cbind(a,b), file = R output.csv, sep = ,)

The result is this:

a   b   
1   1   5
2   2   6
3   3   7
4   4   8
5   5   9

It added an index and shifted the column names by one, b is above a, and a
is above the added index.

Does anybody know a way to prevent this shift from happening? Thanks in
advance.

Kind regards,

Dennis
-- 
View this message in context: 
http://www.nabble.com/write.table-column-names-shift-tp25289490p25289490.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] write.table column names shift

2009-09-04 Thread Stefan Grosse
On Fri, 4 Sep 2009 01:07:49 -0700 (PDT) dennis11
detebe...@hotmail.com wrote:

D It added an index and shifted the column names by one, b is above a,
D and a is above the added index.

Try the option row.names=FALSE in write.table then no index is written.

Stefan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.