Why is the R write.table()
function set to quote column names and label row.names by default?
Also, is it possible to change these defaults so that they do not need to be manually changed in every call of write.table used in a script?
Why is the R write.table()
function set to quote column names and label row.names by default?
Also, is it possible to change these defaults so that they do not need to be manually changed in every call of write.table used in a script?
Just like in studying nature, we generally don't know WHY. It is because R gods said so. This reminds me of stringsAsFactors
being TRUE
by default, which doesn't suit a certain type of users. The beautiful thing about all this is that you can always change it to meet your needs.
What you can do is overwrite the function with custom default values in your .Rprofile
(see this question) or even better, make your own personal R package (perhaps using GitHub?) that implements the same function using different defaults.
You can also copy R's write.table()
into your own custom function e.g. write.table2()
function then change the default value of the logical argument quote
in write.table2()
to false.