How to remove the rownames from the file

随声附和 提交于 2019-12-19 11:27:42

问题


I have a file which looks like this..

"Locations" "X9442" "X5997"
"1" "cg00000957"    0.87    0.86
"2" "cg00001349"    0.78    0.78
"3" "cg00001583"    0.06    0.08
"4" "cg00002028"    0.01    0.01

I wish to remove the row names and make it look like as follows:

 "Locations"    "X9442" "X5997"
 "cg00000957"   0.87    0.86
 "cg00001349"   0.78    0.78
 "cg00001583"   0.06    0.08
 "cg00002028"   0.01    0.01

I tried various things, but I am not able to remove those indexes while doing write.table. Also sometimes the header "Locations" shifts its column. Can someone help me out how do I achieve the above in R or linux?


回答1:


Look at the help file: ?write.table In particular,

write.table(dd, file="output.csv", row.names=FALSE)


来源:https://stackoverflow.com/questions/13646010/how-to-remove-the-rownames-from-the-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!