How to Use The New Function Symbol in R Programming 4.1 (R 4.1)

Pierre DeBois
Analytics Vidhya
Published in
2 min readJul 14, 2021

--

The new forward slash syntax for functions is featured in R 4.1

R Programming version 4.1 introduced a pipe operator symbol — you can read about it in my previous post. The pipe is essentially a shorthand that helps to simplify based coding syntax.

Another symbol shorthand is available. This one is for functions. The function shorthand, a backslash, helps to simplify based coding syntax in R further, and, like the new pipe, makes the code cleaner in appearance.

The backslash function shorthand replaces the function call word used to indicate a function. For example, here is a short program with the standard function in place:

A basic function in R (Image: Pierre DeBois)

Here is the same function with the backslash in place:

The same function with the \ function syntax (Image: Pierre DeBois)

The backslash has one key benefit — in a lengthy program, you can search and highlight the functions quickly by global searching the forward slashes in the documents. That can save time if you have to identify all the functions or make a change in every function quickly. A global search could be done for the word…

--

--

Pierre DeBois
Analytics Vidhya

#analytics |#datascience |#JS |#rstats |#marketing services for #smallbiz | #retail | #nonprofits Contrib @CMSWire @smallbiztrends #blackbusiness #BLM