Call Functions Without Commas Between Arguments

Provides the "comma-free call" operator: '%(%'. Use it to call a function without commas between the arguments. Just replace the '(' with '%(%' in a function call, supply your arguments as standard R expressions enclosed by '{ }', and be free of commas (for that call).


commafree

{commafree} is an R package that provides the "comma-free call" operator: %(%. Use it to call a function with arguments, but without commas separating the arguments. Just replace the ( with %(% in a function call, supply your arguments as standard R expressions enclosed by { } and be free of commas (for that call).

It is especially useful for long multi-line function calls with many arguments, like a shiny UI definition, an R6 class definition, or similar.

%(% merely does a syntax transformation, so that a call like this:

func %(% {
  a
  b
  c
}

is equivalent to writing this:

func(
  a,
  b,
  c
)

Installation

You can install {commafree} like so:

install.packages("commafree")
## Install the dev version:
# remotes::install_github("t-kalinowski/commafree")

Example

library(commafree)

writeLines(c %(% {
  "I write, erase, rewrite"
  "Erase again, and then"
  "A poppy blooms."
})
I write, erase, rewrite
Erase again, and then
A poppy blooms.

Haiku by Katsushika Hokusai

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("commafree")

0.2.0 by Tomasz Kalinowski, 2 years ago


https://github.com/t-kalinowski/commafree


Report a bug at https://github.com/t-kalinowski/commafree/issues


Browse source code at https://github.com/cran/commafree


Authors: Tomasz Kalinowski [aut, cre]


Documentation:   PDF Manual  


GPL (>= 3) license



See at CRAN