How do I convert a .csv file to .tab in R?

时间:2018-09-18 19:51:07

标签: r file file-conversion

I need to convert a file of .csv format to one of .tab format. How do I go about this in R?

1 个答案:

答案 0 :(得分:0)

Copying the correct answer from the comments:

write.table(read.csv("old-file.csv", sep=","), "new-file.tab")

Note that read.csv and write.csv are just read.table and write.table with different defaults.

Also as mentioned in the comments, you might find read_csv and write_tsv from the readr package more pleasant to work with (the built-in R functions can have some surprising behavior).