[R] what is the function naming convention?
Duncan Murdoch
murdoch.duncan at gmail.com
Sun Nov 4 14:28:30 CET 2012
On 12-11-04 8:16 AM, Bretschneider SIG-R wrote:
> 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):
R and its packages have been written by hundreds (thousands?) of people,
and they do not use consistent naming conventions. Perhaps a convention
should have been enforced from the beginning, but it's too late now.
Duncan Murdoch
>
> - 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list