Displaying 2 results from an estimated 2 matches for "bindingisactive".
2013 Nov 16
2
serialization for external pointers
....]
> f <- local( {
+ x <- 1
+ function(v) {
+ if (missing(v))
+ cat("get\n")
+ else {
+ cat("set\n")
+ x <<- v
+ }
+ x
+ }
+ })
> makeActiveBinding("fred", f, .GlobalEnv)
> bindingIsActive("fred", .GlobalEnv)
[1] TRUE
>
> q("yes")
get
get
romain at naxos /tmp $ R
[..]
> fred
[1] 1
> bindingIsActive("fred", .GlobalEnv)
[1] FALSE
Is this possible ? Is there any other hook to handle serialization,
unserialization of external pointers ?...
2007 Mar 28
1
checking existence of active bindings
...onment). (I'm not
trying to claim that this behavior contradicts the documentation, but
it's not what I expected from reading the documentation.)
The only ways I can see to check in pure R if an active binding exists
without calling the binding are things like
> identical(TRUE, try(bindingIsActive("x", globalenv()), silent=TRUE))
> is.element("x", objects(all=T, envir=globalenv()))
but I was hoping to just be able to use exists().
Was this interaction of exists() with active bindings intended, or did
it just arise by accident and might be subject to future improveme...