-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On 16/04/2015 6:19 AM, Rainer M Krug wrote:
Hi
The following code works as expected:
list(plot="Not any more!")
,---- | > plot <- "Not any more!") | [1] "Not any more!" `----
But for this I get an error:
,---- | > function <- "Not any more!" | Error: unexpected
assignment in "function <-" `----
The error message is quite cryptic and does not help much further.
Would it be possible to provide a more useful error message in this
case that (presumably) "function" is a reserved word?
Along the same lines - is there a list of reserved words which can
not be used in R as variable names (not even as elements in a a
list())?
The R Language Definition lists the reserved words (see section
10.3.3). It oversimplifies things, saying they can't be used as
variable names, when in fact almost any string can be used with proper
quoting. For example, both of these work:
"function" <- "Not any more!"
`function` <- "Not any more!"
Duncan Murdoch
This is not a huge problem, but it cost me a few minutes of
figuring out.
Thanks,
Rainer