Standardising Function Names in R

[This article was first published on Why? » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The renamer Package

Tired of the disparate naming systems in R? Then this is the package for you.

Installing the package

The package is located in my drat. To install
install.packages("renamer", repos="", type="source")
or if you have drat installed
drat::addRepo("csgillespie") install.packages("renamer", type="source")
The source is available on my github page

Example: The CamelCaseR

If have an unnatural fear of underscores, that prevents the use of ggplot2, then you are saved
## Assumes you have ggplot2 installed library(renamer) camelCase("ggplot2")
data(cars) ggplot(cars) + geomPoint(aes(speed, dist))

Example: The UnderscoreR

If you’ve want to try the excellent `drat` package, but you find the lack of underscores
unnerving, you too are saved
library(renamer) install.packages("drat", repos="") under_score("drat")
The examples on the drat homepage become
add_repo("eddelbuettel") insert_package("drat_0.0.1.tar.gz")

Future directions

Now that the problem with the R naming system has been solved, the next logical step is
to remove differences *between* languages

  • lisp` converter – randomly add brackets to all functions
  • python – insert spaces/tabs on every line
  • FORTRAN – all code starts on the eighth column

    • To leave a comment for the author, please follow the link and comment on their blog: Why? » R. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
      Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)