hadley wickham
2007-Feb-25 14:44 UTC
[R] Double-banger function names: preferences and suggestions
What do you prefer/recommend for double-banger function names: 1 scale.colour 2 scale_colour 3 scaleColour 1 is more R-like, but conflicts with S3. 2 is a modern version of number 1, but not many packages use it. Number 3 is more java-like. (I like number 2 best) Any suggestions? Thanks, Hadley
Frank E Harrell Jr
2007-Feb-25 15:24 UTC
[R] Double-banger function names: preferences and suggestions
hadley wickham wrote:> What do you prefer/recommend for double-banger function names: > > 1 scale.colour > 2 scale_colour > 3 scaleColour > > 1 is more R-like, but conflicts with S3. 2 is a modern version of > number 1, but not many packages use it. Number 3 is more java-like. > (I like number 2 best) > > Any suggestions? > > Thanks, > > HadleyPersonal preference is for 3. I wish I had used that throughout the Hmisc and Design packages for non-generics. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
John Kane
2007-Feb-25 15:33 UTC
[R] Double-banger function names: preferences and suggestions
--- hadley wickham <h.wickham at gmail.com> wrote:> What do you prefer/recommend for double-banger > function names: > > 1 scale.colour > 2 scale_colour > 3 scaleColour > > 1 is more R-like, but conflicts with S3. 2 is a > modern version of > number 1, but not many packages use it. Number 3 is > more java-like. > (I like number 2 best)I prefer 1 but if it is in conflict with S2 then I go with 3. I just don't like underscores. :)
Gabor Grothendieck
2007-Feb-25 15:53 UTC
[R] Double-banger function names: preferences and suggestions
There is a fourth possibility too: 4. `scale colour` I guess my preference is #1, #2, #3 and #4 in that order with #1 best. Even though #1 can conflict with S3 it usually does not and its historically what R used so I usually just stay consistent with historical precedent. #2 is otherwise best and has the advantage of no conflict with S3. #3 is too hard to read due to the lack of spacing and is probably motivated by misguided Java programmers. The introduction of such names into R was and continues to be a mistake in my opinion. #4 takes up too much screen real estate and the backquotes look too busy. On 2/25/07, hadley wickham <h.wickham at gmail.com> wrote:> What do you prefer/recommend for double-banger function names: > > 1 scale.colour > 2 scale_colour > 3 scaleColour > > 1 is more R-like, but conflicts with S3. 2 is a modern version of > number 1, but not many packages use it. Number 3 is more java-like. > (I like number 2 best) > > Any suggestions? > > Thanks, > > Hadley > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
Alberto Vieira Ferreira Monteiro
2007-Feb-25 15:56 UTC
[R] Double-banger function names: preferences and suggestions
hadley wickham wrote:> > What do you prefer/recommend for double-banger function names: > > 1 scale.colour > 2 scale_colour > 3 scaleColour > > 1 is more R-like, but conflicts with S3. 2 is a modern version of > number 1, but not many packages use it. Number 3 is more java-like. > (I like number 2 best) > > Any suggestions? >I always prefer 2, but this would make it non-portable to S-Plus. S-Plus has a bug, where _ is the equivalent to <- (why would they do this? I prefer to think it's stupidity and not villainy) I guess most (if not all) functions in the libraries use 1. Alberto Monteiro
Barry Rowlingson
2007-Feb-26 10:21 UTC
[R] Double-banger function names: preferences and suggestions
hadley wickham wrote:> What do you prefer/recommend for double-banger function names: > > 1 scale.colour > 2 scale_colour > 3 scaleColour > > 1 is more R-like, but conflicts with S3. 2 is a modern version of > number 1, but not many packages use it. Number 3 is more java-like. > (I like number 2 best)Or you can be lisp-ish and use hyphens (or many other symbols) by quoting: > "scale-colour"=2 > ls() [1] "scale-colour" but that requires further perversions: > get("scale-colour") [1] 2 I like (3), aka camelCase - aka about a dozen other names: http://en.wikipedia.org/wiki/Camel_case - but that's mainly because its widely used in Python, and Python syntax is just marvellous. The more R syntax tends to Python syntax the better. Let's get rid of curly brackets and make whitespace significant... But I digress. As usual. ANytHiNg bUt sTUdLY cApS: http://en.wikipedia.org/wiki/StudlyCaps Barry
hadley wickham
2007-Feb-26 16:28 UTC
[R] Double-banger function names: preferences and suggestions
Thanks to every one who contributed - there definitely isn't a consensus, but perhaps a slight preference towards number 3 (camelCase). I'm not sure yet if this beats out my personal preference for number 2. Hadley On 2/25/07, hadley wickham <h.wickham at gmail.com> wrote:> What do you prefer/recommend for double-banger function names: > > 1 scale.colour > 2 scale_colour > 3 scaleColour > > 1 is more R-like, but conflicts with S3. 2 is a modern version of > number 1, but not many packages use it. Number 3 is more java-like. > (I like number 2 best) > > Any suggestions? > > Thanks, > > Hadley >
Jason Barnhart
2007-Mar-01 17:31 UTC
[R] Double-banger function names: preferences and suggestions
Definitely not #2. Prefer #1 but #3 is ok as well. Thanks for contributing and inquiring. ----- Original Message ----- From: "hadley wickham" <h.wickham at gmail.com> To: <R-help at r-project.org> Sent: Sunday, February 25, 2007 7:44 AM Subject: [R] Double-banger function names: preferences and suggestions> What do you prefer/recommend for double-banger function names: > > 1 scale.colour > 2 scale_colour > 3 scaleColour > > 1 is more R-like, but conflicts with S3. 2 is a modern version of > number 1, but not many packages use it. Number 3 is more java-like. > (I like number 2 best) > > Any suggestions? > > Thanks, > > Hadley > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
Clint Bowman
2007-Mar-01 17:56 UTC
[R] Double-banger function names: preferences and suggestions
I agree with Jason: !2, prefer 1, can accept 3. Clint Bowman INTERNET: clint at ecy.wa.gov Air Dispersion Modeler INTERNET: clint at math.utah.edu Air Quality Program VOICE: (360) 407-6815 Department of Ecology FAX: (360) 407-7534 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels: 300 Desmond Drive, Lacey, WA 98503-1274 On Thu, 1 Mar 2007, Jason Barnhart wrote:> Definitely not #2. Prefer #1 but #3 is ok as well. > > Thanks for contributing and inquiring. > > > ----- Original Message ----- > From: "hadley wickham" <h.wickham at gmail.com> > To: <R-help at r-project.org> > Sent: Sunday, February 25, 2007 7:44 AM > Subject: [R] Double-banger function names: preferences and suggestions > > > > What do you prefer/recommend for double-banger function names: > > > > 1 scale.colour > > 2 scale_colour > > 3 scaleColour > > > > 1 is more R-like, but conflicts with S3. 2 is a modern version of > > number 1, but not many packages use it. Number 3 is more java-like. > > (I like number 2 best) > > > > Any suggestions? > > > > Thanks, > > > > Hadley > > > > ______________________________________________ > > R-help at stat.math.ethz.ch 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 stat.math.ethz.ch 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. >