Re: [R] Fwd: alternative way to define a function

2021-12-02 Thread Martin Møller Skarbiniks Pedersen
On Thu, 2 Dec 2021 at 12:40, Ivan Krylov wrote: > > > The \(arguments) syntax has been introduced in R 4.1.0: > https://cran.r-project.org/doc/manuals/r-release/NEWS.html (search for > "\(x)"). It is the same as function(arguments). > > The only benefit is slightly less typing; could be useful if

Re: [R] Fwd: alternative way to define a function

2021-12-02 Thread Ivan Krylov
On Thu, 2 Dec 2021 12:23:27 +0100 Martin Møller Skarbiniks Pedersen wrote: > Is that exactly the same as: > f <- function(x,y) x * y > ? > > Is there any benefit to the first or second way to define a function? The \(arguments) syntax has been introduced in R 4.1.0: https://cran.r-project.org/d

[R] Fwd: alternative way to define a function

2021-12-02 Thread Martin Møller Skarbiniks Pedersen
By reading some code today I have just discovered an alternative way to define a function: f <- \(x, y) x * y Is that exactly the same as: f <- function(x,y) x * y ? Is there any benefit to the first or second way to define a function? Regards Martin [[alternative HTML version deleted]]