[R] Portected? Variable assignment? Was RE: The use of F for False and T for True

Martin Morgan mtmorgan at fhcrc.org
Mon Nov 17 16:59:24 CET 2008


"Lucke, Joseph F" <Joseph.F.Lucke at uth.tmc.edu> writes:

>  
> The TRUE/FALSE vs. T/F issue brings up a related one.  Can one assign a
> variable a value during an R session that cannot be re-assigned any new
> value during the session?  That is, the variable is `protected' from
> change during the session.  `Session' here is not  precisely defined, so

Environments and their bindings can be locked.

> env <- new.env(parent=emptyenv())
> env[["x"]] <- 10
> lockBinding(env=env, sym="x")
> env[["x"]] <- 11
Error in env[["x"]] <- 11 : cannot change value of locked binding for 'x'

Martin

> that will induce some problems.  A reference to this problem would be
> sufficient.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793



More information about the R-help mailing list