[R] what is the function naming convention?
Bert Gunter
gunter.berton at gene.com
Sun Nov 4 15:45:31 CET 2012
... but see the R Language Definition manual or ?UseMethod for S3
generic and method naming (overloading functions) procedures, which
explains some of as.data.frame.array, merge.data.frame, etc.
-- Bert
On Sun, Nov 4, 2012 at 5:28 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> 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.
>>
>
> ______________________________________________
> 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.
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
More information about the R-help
mailing list