Skip to content
Back to formatted view

Raw Message

Message-ID: <m23840gytu.fsf@krugs.de>
Date: 2015-04-16T10:19:25Z
From: Rainer M Krug
Subject: "function" as variable name - probably better error message

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())?

This is not a huge problem, but it cost me a few minutes of figuring
out.

Thanks,

Rainer

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150416/a23c0afc/attachment.bin>