问题
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