Displaying 20 results from an estimated 20000 matches similar to: "locked environments"
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 with SET_ENVFLAGS and
2009 Mar 16
1
Using and 'eval' and environments with active bindings
The following code produces an error in current R-devel
f <- function(value) {
if(!missing(value))
100
else
2
}
e <- new.env()
makeActiveBinding("x", f, e)
eval(substitute(list(x)), e)
The error, after calling 'eval' is
Error in eval(expr, envir, enclos) :
element 1 is empty;
the part of the args list of 'list'
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
David,
If you are referring to the solution that would be:
rapply(list(test), eval, envir = fenv)
I thought I explained in the question that the above code does not work. It
does not throw an error, but the behavior is no different (at least in the
output or result). Using the above code still results in the x object not
being stored in fenv on 3.1.2.
Dayne
On Wed, Jul 15, 2015 at 4:40 PM,
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
On Jul 15, 2015, at 12:51 PM, William Dunlap wrote:
> I think rapply() was changed to act like lapply() in this respect.
>
When I looked at the source of the difference, it was that typeof() returned 'language' in 3.2.1, while it returned 'list' in the earlier version of R. The first check in rapply's code in both version was:
if (typeof(object) != "list")
2016 Aug 05
2
Extra copies of objects in environments when using $ operator?
My understanding is that R will not make copies of lists if there is
only one reference to the object. However, I've encountered a case
where R does make copies, even though (I think) there should be only
one reference to the object. I hope that someone could shed some light
on why this is happening.
I'll start with a simple example. Below, x is a list with one element,
and changing that
2017 May 11
1
R-3.3.3/R-3.4.0 change in sys.call(sys.parent())
Here is a case where the current scheme fails:
> with(datasets::mtcars, xyplot(mpg~wt|gear)$call)
xyplot(substitute(expr), data, enclos = parent.frame())
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, May 11, 2017 at 1:09 AM, Deepayan Sarkar <deepayan.sarkar at gmail.com>
wrote:
> On Wed, May 10, 2017 at 2:36 AM, William Dunlap via R-devel
> <r-devel at
2017 May 09
3
R-3.3.3/R-3.4.0 change in sys.call(sys.parent())
Some formula methods for S3 generic functions use the idiom
returnValue$call <- sys.call(sys.parent())
to show how to recreate the returned object or to use as a label on a
plot. It is often followed by
returnValue$call[[1]] <- quote(myName)
E.g., I see it in packages "latticeExtra" and "leaps", and I suspect it
used in "lattice" as well.
This idiom
2016 Nov 11
2
Frames in compiled functions
I noticed some problems that cropped in the latest versions of R-devel (2016-11-08 r71639 in my case) for one of my packages. I _think_ I have narrowed it down to the changes to what gets byte-compiled by default. The following example run illustrates the problem I'm having:
compiler::enableJIT(0)
fun <- function(x) local(as.list(parent.frame(2)))
fun(1)
## $x
## [1] 1
##
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
In 3.1.2 eval does not store the result of the bquote-generated call in the
given environment. Interestingly, in 3.2.1 eval does store the result of
the bquote-generated call in the given environment.
In other words if I run the given example with eval rather than evalq, on
3.1.2 "x" is never stored in "fenv," but it is when I run the same code on
3.2.1. However, the given
2015 Feb 26
3
iterated lapply
Would introducing the new frame, with the call to local(), cause problems
when you use frame counting instead of <<- to modify variables outside the
scope of lapply's FUN, I think the frame counts may have to change. E.g.,
here is code from actuar::simul() that might be affected:
x <- unlist(lapply(nodes[[i]], seq))
lapply(nodes[(i + 1):(nlevels - 1)],
2002 Nov 20
2
restart
Dear group
I use "restart" in part of my code, in a way that's not easily changed to
"try". As I convert code from R1.5.0 to R1.6.1, I'm getting ugly messages;
the help system says to contact r-devel, so here I am. This one's a bit
complicated-- sorry!
The context is inside a debugger (I have an R and S debugger that offers
stand-alone code windows, line numbered
2004 Apr 16
2
Windows startup menu display problem in 1.9.0 (PR#6783)
Full_Name: Brian J. Smith
Version: 1.9.0
OS: WinXp
Submission from: (NULL) (129.255.217.48)
WinXP; R 1.9.0 running under Rgui.exe.
winMenuAdd calls via my .Rprofile file do not seem to work and, instead, result
in the following error message after the R GUI starts:
Error in eval(expr, envir, enclos) : couldn't find function "winMenuAdd"
Any subsequent calls to winMenuAdd from
2013 Mar 19
1
source, sys.source and error line numbers
Hi,
is there a way to retrieve the line number of where en error occurred when
sourcing a file in a tryCatch statement? Is it stored somewhere accessible?
It is not found in the error object.
Consider the following code/output and note the difference in the traceback
between source (has line number) and sys.source (has no line number).
Thank you,
Renaud
########
# code
########
codefile <-
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
I think rapply() was changed to act like lapply() in this respect.
In R-3.1.3 we got
rapply(list(quote(1+myNumber)), evalq, envir=list2env(list(myNumber=17)))
#[1] 18
rapply(list(quote(1+myNumber)), eval, envir=list2env(list(myNumber=17)))
#Error in (function (expr, envir = parent.frame(), enclos = if
(is.list(envir) || :
object 'myNumber' not found
lapply(list(quote(1+myNumber)),
2006 Feb 01
1
recover() (PR#8546)
After using options(error=recover),
it takes a long time (too long) to get back
to the prompt. Look at:
Browse[1]> recover()
Enter a frame number, or 0 to exit
1: window(test, start = c(15, 1), end = c(17, 1), extend = TRUE)
2: window.ts(test, start = c(15, 1), end = c(17, 1), extend = TRUE)
3: as.ts(window.default(x, ...))
4: window.default(x, ...)
5: function ()
6: eval(quote(browser()),
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
Another aspect of the change is (using TERR's RinR package):
> options(REvaluators=list(makeREvaluator("R-3.1.3"),
makeREvaluator("R-3.2.0")))
> RCompare(rapply(list(quote(function(x)x),list(quote(pi),quote(7-4))),
function(arg)typeof(arg)))
R version 3.1.3 (2015-03-09) R version 3.2.0 (2015-04-16)
[1,] [1]
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
Bill,
Is your conclusion to just update the code and enforce using the most
recent version of R?
Dayne
On Wed, Jul 15, 2015 at 4:44 PM, Dayne Filer <dayne.filer at gmail.com> wrote:
> David,
>
> If you are referring to the solution that would be:
>
> rapply(list(test), eval, envir = fenv)
>
> I thought I explained in the question that the above code does not work.
From THE R BOOK -> Warning: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
2010 Mar 30
3
From THE R BOOK -> Warning: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
Dear friends,
I am testing glm as at page 514/515 of THE R BOOK by M.Crawley, that is
on proportion data.
I use glm(y~x1+,family=binomial)
y is a proportion in (0,1), and x is a real number.
I get the error:
In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
But that is exactly what was suggested in the book, where there is no
mention of a similar warning. Where am I
2004 Aug 09
1
error when calling debugger()
Hi,
I am getting an error message when I am trying to run the debugger() on
the last.dump. The debugger() stops after I make a selection. Could
someone please suggest what it might mean? The R log is included below.
This is R-1.8.1 on RH 7.3.
Thanks, Vadim
> load("last.dump.rda")
> debugger(last.dump)
Message: Error in split(x, f) : Group length is 0 but data length > 0
2013 Feb 18
2
quote() vs quote(expr=)
Hi all,
I think there's a small buglet in quote:
str(quote())
# Error in quote() : 0 arguments passed to 'quote' which requires 1
str(quote(expr = ))
# symbol
I bring this up because this seems like the most natural way of
capturing the "missing" symbol with pure R code, compared to
substitute() or bquote() or formals(plot)$x
Hadley
--
Chief Scientist, RStudio