Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Naming Functions

20201102

resume
Function argument names use underscore separated nouns. Whilst function argument names do not risk being confused with class hierarchies the use of period to separate the nouns has become obsolete in the tidyverse world.

Preferred

build_cyc(num_frames=10)

Discouraged

build_cyc(num.frames=10)
build_cyc(numFrames=10)

Keep variable and function names shorter but self explanatory. A long variable or function name is problematic with layout and similar names are hard to tell apart. Single letter names like x and y are often used within functions and facilitate understanding, particularly for mathematically oriented functions but should otherwise be avoided. l Preferred

# Perform addition.

add_squares <- function(x, y)
{
  return(x^2 + y^2)
}

Discouraged

# Perform addition.

add_squares <- function(first_argument, second_argument)
{
  return(first_argument^2 + second_argument^2)
}


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.