Skip to content
Back to formatted view

Raw Message

Message-ID: <8b356f880903091631m4f287214k399aa99ad2dddecb@mail.gmail.com>
Date: 2009-03-09T23:31:53Z
From: Stavros Macrakis
Subject: bug of *switch* function
In-Reply-To: <8cca69990903090746u7600e052l7244603c974616e6@mail.gmail.com>

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