Displaying 20 results from an estimated 3000 matches similar to: "Using and 'eval' and environments with active bindings"
2005 Apr 06
1
makeActiveBinding warning
A while ago Luke Tierney remarked that the warning associated with
'makeActiveBinding'-- "saved workspaces with active bindings may not
work properly when loaded into older versions of R"-- should probably be
removed in R-devel. It's still cropping up *sporadically* with R-alpha
of 3/4/2004, but not every time I call 'makeActiveBinding'.
So, two questions:
(i) is it
2020 May 24
1
Surpising behavior when using an active binding as loop index in R 4.0.0
A shorter reproducible example:
example(makeActiveBinding)
for (fred in 1:3) { 0 }
ls()
Both problems go away if you first do
compiler::enableJIT(2)
So looks like a bug in compiling the for loop.
-Deepayan
On Sat, May 23, 2020 at 5:45 PM Thomas Friedrichsmeier via R-devel
<r-devel at r-project.org> wrote:
>
> Possibly just a symptom of the earlier behavior, but I'll amend my
2010 Jan 06
1
MakeActiveBinding help needed
Hi,
I wanted a Q&D way to open a new graphics window but keep the focus in
the console window (under Windows and the Rgui), so I wrote a line into
my Rprofile.site file as follows:
invisible(makeActiveBinding('newdev', function(...)
dev.new(restoreConsole=T), .GlobalEnv))
(That is all on one line, incase the mailer re-parses it). This gives me
a command "newdev" which
2009 Nov 05
2
Active bindings in attached environments
Hi,
I was wondering if this is expected behavior for active bindings in
attached environments, or if this is a bug:
> e <- new.env()
> makeActiveBinding('x',function() 'foo',e)
> ls(e)
[1] "x"
> attach(e)
> search()
[1] ".GlobalEnv" "e" "package:graphics"
[4] "package:grDevices"
2010 Aug 21
1
Speed improvement to evalList
I've been inspired to look at the R source code by some strange timing
results that I wrote about on my blog at radfordneal.wordpress.com
(see the posts on "Speeding up parentheses..." and "Two surprising
things...".
I discovered that the strange speed advantage of curly brackets over
parentheses is partially explained by an inefficiency in the evalList
and
2020 May 23
2
Surpising behavior when using an active binding as loop index in R 4.0.0
Hi,
I stumbled upon a surprising behavior when using an active binding as a
loop index variable in R 4.0.0. In contrast, the behavior observed in R
3.6.1 is in line with my expectations.
Consider the code below:
makeActiveBinding("i",
function(value) {
if (missing(value)) {
x
} else {
print("set")
x <<- value
}
}, globalenv())
i <- 1 # output
2013 Nov 16
2
serialization for external pointers
Hello,
Are there any recipe to handle serialization / deserialization of
external pointers.
I'm thinking about something similar in spirit to the way we handle
finalization of external pointers.
Currently, if we create an external pointer, save the session, quit R,
then load the session, we get a null pointer.
One way I'm thinking of is to have an environment in the
2011 Jan 13
2
Method dispatch for function call operator?
Dear R gurus,
I am trying to create a nicer API interface for some R modules I have
written. Here, I heavily rely on S3 method dispatch mechanics and
makeActiveBinding() function
I have discovered that I apparently can't dispatch on function call
operator (). While .Primitive("(") exists, which leads me to believe that
things like x(...) are internally translated to
2005 Mar 11
3
delay() has been deprecated for 2.1.0
After a bunch of discussion in the core group, we have decided to
deprecate the delay() function (which was introduced as "experimental"
in R 0.50). This is the function that duplicates in R code the
delayed evaluation mechanism (the promise) that's used in evaluating
function arguments.
The problem with delay() was that it was handled inconsistently (e.g.
sometimes you would see
2008 Oct 10
2
Fatal error: unable to restore saved data in .RData
Hello,
I am unable to start an R session by double-clicking on an existing
.RData file from the Windoze file explorer.
A dialogue appears with the message
"Fatal error: unable to restore saved data in .RData",
and I notice in the R Console the last few lines are:
"Loading required package: R2HTML
NULL
error in function () : unused argument(s) (1:43)"
I tried starting
2011 Apr 06
0
Activating a Regular Binding
Greeting R-devel,
I find myself wanting to attach an active binding to an existing
object in the global environment (R 2.12.2), but there doesn't seem to
be an easy way to do this:
> x = 5
> makeActiveBinding("x", function(d) "hi", .GlobalEnv)
Error in makeActiveBinding("x", function(d) "hi", .GlobalEnv) :
symbol already has a regular binding
2004 Mar 12
1
Re: [R] No traceback available when using try(...) (PR#6669)
On Fri, 12 Mar 2004 11:44:14 -0500, "Roger D. Peng" <rpeng@jhsph.edu>
wrote :
>Funny, it works for me on R-patched
>
> > f <- function(a) { return(log(a)) }
> > f("A")
>Error in log(x) : Non-numeric argument to mathematical function
> > traceback()
>2: log(a)
>1: f("A")
> > try(f("A"))
>Error in log(x) :
2009 Jun 29
1
active bindings and ls.str
Hello,
Should active binding appear as such in ls.str.
> makeActiveBinding( "xx", function(arg){ Sys.sleep(10) }, .GlobalEnv )
> ls.str() # takes 10 seconds
xx : NULL
What we see here is the result of the "setter" of the binding.
I'm attaching a patch that prints this instead:
> ls.str()
xx : <active binding>
Although a better behaviour would be to
2009 Aug 01
2
Variable alias
Hi Everyone,
is there the possibility in R to assign a variable to be an alias of
another one?
Example:
x <- 17
# assign y to be an alias of x
y # returns 17
x <- 4
y # returns 4
Daniel
2007 Mar 28
1
checking existence of active bindings
Is there any way to check whether an active binding exists without
actually calling the active binding? I'd like to be able to do
something like exists("x", ...) and know whether "x" exists without
actually fetching its value if it is an active binding (because it could
consume significant resources to fetch the value).
The documentation for exists() doesn't
2020 Jun 15
2
numericDeriv alters result of eval in R 4.0.1
Dear R developers,
I've run into a weird behavior of the numericDeriv function (from the stats
package) which I also posted on StackOverflow (question has same title as
this email, except for the version of R).
Running the code bellow we can see that the numericDeriv function gives an
error as the derivative of x^a wrt a is x^a * log(x) and log is not defined
for negative numbers. However,
2020 Jun 16
1
[External] numericDeriv alters result of eval in R 4.0.1
Dear all
As far as I could trace, looking at the function C function numeric_deriv,
this unwanted behavior comes from the inner most loop in, at the very end
of the function,
for(i = 0, start = 0; i < LENGTH(theta); i++) {
for(j = 0; j < LENGTH(VECTOR_ELT(pars, i)); j++, start += LENGTH(ans)) {
SEXP ans_del;
double origPar, xx, delta;
origPar = REAL(VECTOR_ELT(pars, i))[j];
2008 Apr 04
0
cacher v0.1-2
The 'cacher' package contains a set of routines for caching statistical
analyses. The idea is that an analysis stored in a file (say, 'foo.R') is run
and the results of the evaluated expressions are cached in a database. These
cached results can subsequently be packaged up and distributed over the interweb.
I've just uploaded to CRAN version 0.1-2 of the 'cacher'
2008 Apr 04
0
cacher v0.1-2
The 'cacher' package contains a set of routines for caching statistical
analyses. The idea is that an analysis stored in a file (say, 'foo.R') is run
and the results of the evaluated expressions are cached in a database. These
cached results can subsequently be packaged up and distributed over the interweb.
I've just uploaded to CRAN version 0.1-2 of the 'cacher'
2008 Aug 28
0
Can the file locking in filehash be reused? (Was: Re: [R] [R-pkgs] filehash 2.0)
Hi (Roger),
I saw the announcement of filehash v2.0 and the sentence "This
development has lead to better file locking for concurrent access and
faster reading and writing of data in general" caught my attention.
What kind of file locking do you refer to here?
I am looking for a mechanism that can be used to lock files for
reading and/or writing, and I'd love to have a cross