问题
I was wondering if it is possible to change the default value for a built-in function in R? I have found some questions about setting default values for user made functions in R, but not for built-in functions.
Why do I want this? To be honest, it is purely a matter of convenience. Sometimes I write my results/data to a .csv file to make some quick graphs in Excel. To do this I use the write.csv function. One of the defaults in this function is row.names = TRUE. So far, I have never wanted the row.names in my Excel file and I have forgotten to add row.names = FALSE  to the function dozens of times. So is it possible to change the default value in this function to row.names = FALSE?
回答1:
No. But if you want convenience, write a wrapper function yourself. For example:
my_write.csv <- function(...) write.csv(..., row.names = FALSE)
then you use my_write.csv.
来源:https://stackoverflow.com/questions/38501035/change-the-default-value-in-a-built-in-function