我有一个 csv 文件,我使用 read.csv 将其加载到 R 中并执行了一些操作。而且,现在我需要将其写回 csv 格式。然而问题是, write.table() 函数不会产生所需的输出。
初始数据:
id,name,Households,Population,Total Male,Total Female
0,Nepal,5427302,26494504,12849041,13645463
1,Taplejung,26509,127461,60552,66909
2,Panchthar,41196,191817,90186,101631
3,Ilam,64502,290254,141126,149128
4,Jhapa,184552,812650,385096,427554
使用 write.table() 的最终输出
"id","name","Households","Population","SexRatio"
"1",0,"Nepal",5427302,26494504,94.1634666408901
"2",1,"Taplejung",26509,127461,90.499036004125
"3",2,"Panchthar",41196,191817,88.7386722555126
"4",3,"Ilam",64502,290254,94.634139799367
"5",4,"Jhapa",184552,812650,90.0695584651295
如何获得输入格式的最终输出?