Displaying 7 results from an estimated 7 matches for "lockenvironment".
2014 Aug 11
1
Error when assigning value in environment which is a locked binding
If an environment x contains a locked binding y which is also an
environment, and then you try to assign a value to a binding inside of
y, it can either succeed or fail, depending on how you refer to
environment y.
x <- new.env()
x$y <- new.env()
lockEnvironment(x, bindings = TRUE)
# This assignment fails
x$y$z <- 1
# Error in x$y$z <- 1 : cannot change value of locked binding for 'y'
# Saving x$y to another variable, and then assigning there works
y2 <- x$y
y2$z <- 10 # OK
print(x$y$z)
# 10
Is this a bug or a feature? I realize th...
2016 Apr 20
1
locked environments
Shouldn't the following 4 ways to alter an object in a locked environment
either all work or all fail? (All working would be nice, I think.)
E <- new.env()
assign("var", c(1,2,3,4), envir=E)
lockEnvironment(E, bindings=FALSE)
E$var[1] <- 101 ; E$var
#[1] 101 2 3
local(var[2] <- 102, envir=E)
#Error in eval(expr, envir, enclos) :
# cannot add bindings to a locked environment
with(E, var[3] <- 103)
#Error in eval(expr, envir, enclos) :
# cannot add bindings to a lo...
2018 Oct 10
1
unlockEnvironment()?
R lets one lock an environment with both an R function,
base::lockEnvironment, and a C function, R_LockEnvironment, but, as far as
I can tell, no corresponding function to unlock an environment. Is this
omission on principle or just something that has not been done yet?
I ask because several packages, including the well-used R6 and rlang
packages, fiddle with some bits in...
2014 Jan 22
1
Creating Namespace and locking it during runtime?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi
I would like to create a Namespace during runtime, and not during
loading a package.
My reasoning is that I want to be able to store a number of variables
and to "protect them from the user" (might be even myself). The code
will not be in a package, but will be source()ed.
Next step: pass variables from org mode / emacs to R and to
2009 Dec 03
1
S4 Classes, nested objects and references
Hi all,
I'm currently programming my first complete package in S4. (thanks to
Christophe Genolini for the nice introduction he wrote). I have an
object "Data" with a number of slots. One of those slots is "meteo".
Now "Meteo" is on itself a class with again a number of slots (like
rainfall, temperature,..., you get the picture).
I defined the slot
2008 Oct 20
2
R 2.8.0 is released
...n argument 'strictly'. It now works for
classed objects with a >= or > method (as incorrectly
documented earlier).
o library() no longer warns about the masking objects that are
identical(.,.) to those they mask.
o lockBinding(), unlockBinding(), lockEnvironment() and
makeActiveBinding() now all return invisibly (they always
return NULL).
o mood.test() now behaves better in the presence of ties.
o na.action() now works on fits of classes "lm", "glm", ....
o optim(.., method="SANN", .., trac...
2008 Oct 20
2
R 2.8.0 is released
...n argument 'strictly'. It now works for
classed objects with a >= or > method (as incorrectly
documented earlier).
o library() no longer warns about the masking objects that are
identical(.,.) to those they mask.
o lockBinding(), unlockBinding(), lockEnvironment() and
makeActiveBinding() now all return invisibly (they always
return NULL).
o mood.test() now behaves better in the presence of ties.
o na.action() now works on fits of classes "lm", "glm", ....
o optim(.., method="SANN", .., trac...