[R] Declaring variables in R

Moshe Olshansky m_olshansky at yahoo.com
Fri Oct 19 06:05:23 CEST 2007


Please forgive me if my question is answered in Help
FAQ no. 23481739...

In language like C every variable must be declared
before it can be used.
In VBA, if a variable has not been declared it is
assumed to be of a special type (Variant).
In R (and Matlab) variables do not have to be
declared. This is convenient, but in a large program
one can make a typo which will be extremely difficult
to find.
In VBA one can use a special statement (Option
Explicit) which does not allow using variables which
have not been previously declared. As far as I
remember this can also be done in Matlab (or at least
there is a utility which can check whether your
program uses undeclared variables).

My question is: does such an option/utility exist in
R?

Thank you.

Moshe.



More information about the R-help mailing list