In 1.4 or later have a look at ?lockBinding:
> x <- 5
> lockBinding("x",.GlobalEnv)
NULL
Warning message:
saved workspaces with locked bindings may not work properly when loaded into
older versions of R > x <- 8
Error: can't change value of a locked binding
The facility and the interface are still experimental, so details may
change.
luke
On Sun, Apr 14, 2002 at 08:00:59PM +0200, Christoph Lange
wrote:>
> I wonder if it was possible (and desireable) to implement means to
> protect data objects (and functions) from overwriting them. So for
> instance:
>
> > x <- 5
> > protect(x)
> > x <- 8
> Error: x is read only
>
>
> Or would that be against the philosophy of R to be compatible to S?!
>
> Just a RFC ;-)
>
> Yours,
> Christoph.
>
> ps. Your probably know the situations that let you think of such a
> feature :-( ...
>
> --
> Christoph Lange clange at epost.de
> Verhaltensbiologie, FU Berlin 838-55068
> Haderslebener Str. 9, 12163 Berlin
> http://www.verhaltensbiologie.fu-berlin.de/
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
--
Luke Tierney
University of Minnesota Phone: 612-625-7843
School of Statistics Fax: 612-624-8868
313 Ford Hall, 224 Church St. S.E. email: luke at stat.umn.edu
Minneapolis, MN 55455 USA WWW: http://www.stat.umn.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._