[R] what is the function naming convention?

Bretschneider SIG-R bretschr at xs4all.nl
Sun Nov 4 14:16:20 CET 2012


Dear R people,



In typing names of functions (built in or from a package) I often guess wrong, and have to look the name up.
In other words, I don't understand the logic in naming functions (if there is any):

-  most names are plain, lower case:  cos,  plot,  sapply,  t,  toupper,  unserialize,  (etc) 

-  some are capitalized:  Filter,  Machine,  Map,  NCOL,  RNGversion,  T  (etc) 

-  many are dotted:  as.complex,  as.data.frame.array,  merge.data.frame,  write.dcf  (etc) 

The manual "Creating R Packages" states that it depends on the classes and instances. I couldn't find more hints.

And there's more:

-  using underscore characters:  check_tzones,  Cstack_info,  R_system_version  (etc)

-  using interCapping:  closeAllConnections,  rawToChar,  rowSums,  toString,  tryCatch,  writeLines  (etc)

-  using dots and intercapping:  as.Date,  julian.Date,  toString.default  (etc)



So, an entire zoo of function names.
Did I miss a system, or is it arbitrary (within the set of accepted characters) ? 
What is the best way to name one's own functions?

Thanks in advance,



Franklin Bretschneider
----------------------------
Utrecht University
Dept Biology
Kruytgebouw W711
Padualaan 8
3584 CH Utrecht
The Netherlands



More information about the R-help mailing list