[R] Questíon regarding the use of write.csv2, write.table ...

Lavri Labi lavri.labi at tu-dortmund.de
Thu Jun 18 12:35:31 CEST 2009


Dear Jorge,

thank you for the quick answer. But I am afraid you didn´t understand my
problem. I want to write the following data frame "exampleDataframe" in a
csv2-file.

"a";"b";"c";"d"
 1 ; 2 ; 3 ; 4
 5 ; 6 ; 7 ; 8
 9 ; 0 ; 1 ; 2

After sending the command:

write.csv2(exampleDataframe,file="exampleDataframe.csv")

I become the following file:

"";"a";"b";"c";"d"
1 ; 1 ; 2 ; 3 ; 4
2 ; 5 ; 6 ; 7 ; 8
3 ; 9 ; 0 ; 1 ; 2

How can I delete the first column added, which I do not need?

The row.names you suggest me is not reallly helpful in this case.

Cheers,

Lavri



> Dear Lavri,
> Take a look at the row.names argument in ?write.table.
>
> HTH,
>
> Jorge
>
>
> On Thu, Jun 18, 2009 at 4:09 AM, Lavri Labi
> <lavri.labi at tu-dortmund.de>wrote:
>
>> Hi all,
>>
>> I use "write.csv" and "write.table" to write a data frame in a file like
>> following:
>> write.csv2(allRandomTestCase_XDroped, "allRandomTestCase.csv")
>> But in the created file "allRandomTestCase.csv" an additional column
>> with
>> consecutive numbers is automatically added to the column of the data
>> frame
>> "allRandomTestCase_XDroped".
>>
>> That is why my question, how can I write data in a file without this
>> added
>> column?
>>
>> Cheers,
>>
>> Lavri
>>
>> ______________________________________________
>> R-help at 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.
>>
>




More information about the R-help mailing list