[Rd] bug of *switch* function

Stavros Macrakis macrakis at alum.mit.edu
Tue Mar 10 00:31:53 CET 2009


On Mon, Mar 9, 2009 at 8:55 AM, guangchuang yu
<guangchuangyu at gmail.com> asked why switch(..., a <- 3, ...) doesn't
have the same effect as switch(..., a=3, ...).

In most contexts, `<-` and `=` are synonymous in R, and mean
assignment. In function-argument position, however, an infix `=` names
the argument.  Switch depends on the argument names.

            -s



More information about the R-devel mailing list