write to csv file using separator

r

Solution

In countries where `,` is used as a decimal separator (France and Germany for example), "csv" files are actually semi-colon separated (it is the default on all spreadsheet program if you install those countries specific version). So `write.table(result, file ="F:\\filename.csv",row.names=FALSE,sep=";")` would be quite classic. So classic actually that there is a wrapper for it:

write.csv2(result, file ="F:\\filename.csv",row.names=FALSE)

`write.csv2` use `sep=";"` and `dec=","` as default.

Otherwise for a tab-delimited files the argument is `sep="\t"`.

Problem

I want to write my resulted matrix into csv file. I used the code ``` write.table(result, file ="F:\\filename.csv",row.names=FALSE,sep=",") ``` But my results already having some "," value,so what type of separator use to write these type of data. I already used 'tab' as the separator but at that time it did not split as column, the values were inserted into a single column. I also tried ``` write.csv(result, file ="F:\\filename.csv",row.names=FALSE) ``` but this time the single column content is splited into multiple column .

Original source