rmergewrite.table

How to remove first column of auto generated counts from an R merged file?


I have merged two files in R using merge and named it as 'mergedfile'. When I save the file as .txt on my desktop using write.table("mergedfile", "~/Desktop/mergedfile.txt", sep = "\t"), it adds an autogenerated column of row numbers in the file. How can I remove this column without loosing any original headers' name in the file when using write.table or another way to save the merged file on Desktop that doesn't include the first autogenerated column of row numbers?


Solution

  • You can try:

    write.table(mergedfile,file="~/Desktop/mergedfile.txt",sep='\t',row.names = F)