[R] Writing .csv file
John McKown
john.archie.mckown at gmail.com
Wed Sep 24 23:13:45 CEST 2014
On Wed, Sep 24, 2014 at 4:00 PM, Steven Yen <syen04 at gmail.com> wrote:
> I use the following command to write data to a .csv file:
>
> write.csv(yxz,file="foo.csv")
>
> And I get the following in the file, with one column appended to the file:
>
> "","fsp","fsec","cincome",
> "1",0,3,2.25,...
> "2",0,1,2.75,...
> "3",1,1,0.625,...
>
> Question: is there a way to avoid the first column? Thanks.
>
I'm fairly sure you need:
write.csv(yxz,file="foo.csv",row.names=FALSE);
If you don't want the header row at the top, you might want to try:
write.table(yxz,file="foo.csv",row.names=FALSE,col.names=FALSE,sep=',',qmethod="double");
--
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan
Maranatha! <><
John McKown
More information about the R-help
mailing list