Re: [R] = or <-

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon, 02 Jun 2008 10:27:56 -0400

No function accepts <- in place of =. In the first of the 4 examples below we are simply setting variable b to 10 and then passing it to f as its first argument. f(b = 10) would be different since that specifies that we want argument b to take on the value of 10.

f <- function(a=1, b=2) a-b

# these 5 lines below all give the same result
# except the first 3 also have the side effect
# of creating a variable b

f(b <- 10)
b <- 10; f(b)
f(a = b <- 10)
f(10)
f(a=10)

On Mon, Jun 2, 2008 at 10:05 AM, Sébastien <pomchip_at_free.fr> wrote:
> Dear R-users,
>
> I have written a short VB application to clean and format my R code.
> Everything works fine except one small issue that I did not expected; it is
> related the automatic replacement of assignment signs from "=" to "<-". Most
> functions or arguments seem to accept either = or <-, but some don't (e.g.
> ls(all=TRUE)). The result is that my supposedly clean codes do not run
> anymore :-(
> Is there a way to know the list of arguments/functions that do not accept
> "<-" signs ?
>
> Thanks in advance.
>
> Sebastien
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 02 Jun 2008 - 17:31:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jun 2008 - 18:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive