Introduction to the r2shortcode R Package

O.N Obianom

2020-06-24

The number of R packages created per month by users is increasing dramatically. When creating a package, authors may sometimes struggle with coming up with easy to remember function names, and at the same time hoping that other packages do not already have the same function names. In trying to meet this goal sometimes, function names are not descriptive enough and may confuse the potential users. The purpose of the r2shortcode package is to serve as a package function shortener and also provide shorthand names for other functions. Having this package will entice authors to create long function names without the fear of users not wanting to use their packages because of the long names. In a way, everyone wins - the authors can use long descriptive function names, and the users can use the r2shortcode to shorten the functions while still using the package in question.

Below is an example to demonstrate how the r2shortcode package can be used to shorten function names in a package called r2resume - main site or github site

Attach the r2shortcode package

First, attach the package shortener, r2shortcode package


library("r2shortcode")
#> r2shortcodes: a package that shortens your other packages
#> 
#> Attaching package: 'r2shortcode'
#> The following object is masked from 'package:utils':
#> 
#>     help

Call the shorten function to shorten the package

Second, call the shorten function to shorten a desired package already installed in your library


shortenPkg("r2resume",addPrefix = T)
# you may include more packages on a new line

List the shorthand functions and their matching functions

Thirdly, get a list of the created shorthand function names and their corresponding functions


index("r2resume")

Get help for a specific shorthand function

Forthly and alternatively, get the description for a specific shorthand function


help("r2.gP") #OR whatis("r2.gP")