0
我有一個輸入csv文件,Input.csv
,看起來像這樣:停機v更改「」到」 CSV文件中
"VariableOne";"VariableTwo"
"Hello, how are you?";"I'm fine, thank you!"
"He said ""how are you?"" to her";"She responded ""I'm fine, thank you!"" and then left."
"Good bye!";"Good bye!"
注意雙引號,""
,行情可變文本內。
現在,我的R程序看起來像這樣:
Data <- read.csv2("./Input.csv",header=TRUE, sep=";", quote="\"")
write.table(Data,file="Output.csv",sep=";",row.names=FALSE, quote=TRUE)
該程序產生下面的輸出CSV文件,Output.csv
:
"VariableOne";"VariableTwo"
"Hello, how are you?";"I'm fine, thank you!"
"He said \"how are you?\" to her";"She responded \"I'm fine, thank you!\" and then left."
"Good bye!";"Good bye!"
注意,雙引號,""
,已被替換\"
。這對我來說會導致很多問題,我希望雙引號""
不會改變輸出。
我該如何做到這一點?
謝謝!那樣做了! – Speldosa 2015-02-05 19:56:05