[R] How to write '"' to a csv with the default setting of write.csv?

Peng Yu pengyu.ut at gmail.com
Fri Jan 22 00:38:02 CET 2010


On Thu, Jan 21, 2010 at 5:32 PM, milton ruser <milton.ruser at gmail.com> wrote:
> Hi Peng,
>
> May be write.table(...,quote=F)
>
> bests
>
> milton

Would this cause some trouble when filed is missing, etc.? Although I
don't have a concrete example, I think that it might happen. So I
prefer to have quote=T.

I have looking for a way so that the resulted csv file can be read by excel.

http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm#FileFormat


> On Thu, Jan 21, 2010 at 6:29 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
>>
>> Please see the following example. I can not write '"' to a csv file
>> successfully. Could somebody let me if it is possible to write '"' to
>> a csv file with the default setting of write.csv?
>>
>> my_home$ Rscript main_quote.R
>> > x=rbind(
>> +   "\"A\""
>> +   , "\"B\""
>> +   )
>> > x
>>     [,1]
>> [1,] "\"A\""
>> [2,] "\"B\""
>> >
>> > write.csv(x, "main_quote.csv", row.names=F)
>> >
>> my_home$ cat main_quote.csv
>> "V1"
>> """A"""
>> """B"""
>>
>> ______________________________________________
>> 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