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

From: Martin Morgan <mtmorgan_at_fhcrc.org>
Date: Mon, 17 Nov 2008 07:59:24 -0800

"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

______________________________________________
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.
Received on Mon 17 Nov 2008 - 16:06:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Nov 2008 - 16:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive