The State of namingConventions in R

July 16, 2013
By

(This article was first published on Open Analytics - Blog, and kindly contributed to R-bloggers)

Last week's 2013 useR! conference was filled to the brim with informative talks, but hands down the crown for most entertaining talk goes to Rasmus Bååth's State of Naming Conventions in R presentation.

Rasmus' lighthearted talk leveraged the strongest common bond among R users: collective suffering at the hands of R's haphazard naming conventions. Who among us hasn't fumbled away at the keyboard trying to recall the punctuation scheme of some scarcely used utility function?

Whereas other programming languages demand adherence to rigid naming conventions, R's function names are a veritable circus.

R naming conventions

And that's just in base R!

After several laughs over the dire state of affairs, Rasmus transitioned to exploring the negative consequences of heterogeneous naming conventions. Namely, they make R harder to learn and harder to use. For example, when trying to use the as.Date() function, a user might make several attempts before ultimately finding the correct function call.

as date

Clearly things could be better with the benefit of hindsight, and it was at this point in the talk that I began to wonder whether Rasmus could “bring things home”, so to speak. Yes, the conventions are chaotic, but just as we can't tear up a city's streets and relay them in a more intelligent configuration, we can't simply rename all of R's existing functions.

Naturally, Rasmus had a very practical suggestion:

use autocompletion

Autocompletion is a great tool, but in many IDEs autocompletion does not work if you've already made a mistake. For example, if users try to find the function 'Vectorize', autocompletion in some editors will leave them high and dry.

rstudio

The onus, Rasmus argues, is on developers to bridge the gap between users and R's inconsistent naming schemes.

Fortunately, that gap has already been bridged. Architect users have long enjoyed intelligent autocomplete functionality. Simply use 'Ctrl + Space' and the Architect editor will suggest matching functions, regardless of your exact syntax.

Ctrl Space Keys

Can't remember the exact way to specify a function? No problem.

auto complete

auto complete

auto complete

Simple!

Download Architect

Rasmus Bååth's useR Blog

This post is about:
architect, useR

To leave a comment for the author, please follow the link and comment on his blog: Open Analytics - Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.