similar to: testing for emptyenv

Displaying 20 results from an estimated 6000 matches similar to: "testing for emptyenv"

2019 Mar 23
4
topenv of emptyenv
I was surprised just now to find out that `topenv(emptyenv())` equals ? `.GlobalEnv`, not `emptyenv()`. From my understanding of the description of `topenv`, it should walk up the chain of enclosing environments (as if by calling `e = parent.env(e)` repeatedly; in fact, that is almost exactly its implementation in envir.c) until it hits a top level. However, `emptyenv()` has no enclosing
2008 Nov 17
4
functional (?) programming in r
the following is a trivialized version of some functional code i tried to use in r: (funcs = lapply(1:5, function(i) function() i)) # a list of no-parameter functions, each with its own closure environment, # each supposed to return the corresponding index when applied to no arguments sapply(funcs, function(func) func()) # supposed to return c(1,2,3,4,5) there is absolutely nothing unusual in
2010 Jul 14
2
How to define a function (with '<-') that has two arguments?
Hi All, The last line if the following code returns the error right below this paragraph. Essentially, I use the operator %:% to retrieve a variable in a nested frame. Then I want to use the same operator (with '<-') to change its value. I'm not sure if this is possible in R with %:% operator. Would you please help and let me how to correct the code if it is possible? Error in
2019 Mar 28
0
topenv of emptyenv
>>>>> Konrad Rudolph >>>>> on Sat, 23 Mar 2019 14:26:40 +0000 writes: >>>>> Konrad Rudolph >>>>> on Sat, 23 Mar 2019 14:26:40 +0000 writes: > I was surprised just now to find out that `topenv(emptyenv())` equals > ? `.GlobalEnv`, not `emptyenv()`. From my understanding of the > description of `topenv`, it
2013 Apr 18
2
how to control the environment of a formula
Dear List I have experienced that objects generated with one of my packages used a lot of space when saved on disc (object.size did not show this!). some debugging revealed that formula and call objects carried the full environment of subroutines along, including even stuff not needed by the formula or call. here is a sketch of the problem ,---- | test <- function(x){ | x <-
2009 Jun 02
2
formal argument "envir" matched by multiple actual arguments
Hi list, This looks similar to the problem reported here https://stat.ethz.ch/pipermail/r-devel/2006-April/037199.html by Henrik Bengtsson a long time ago. It is very sporadic and non-reproducible. Henrik, do you remember if your code was using reg.finalizer()? I tend to suspect it but I'm not sure. I've been hunting this bug for months but today, and we the help of other Bioconductor
2020 Aug 10
1
lm() takes weights from formula environment
Thank you for your suggestion. I do know how to work around the issue. I usually build a fresh environment as a child of base-environment and then insurt the weights there. I was just trying to provide an example of the issue. emptyenv() can not be used, as it is needed for the eval (errors out even if weights are not used with "could not find function list"). For some applications
2006 Apr 04
2
Return function from function with minimal environment
Hi, this relates to the question "How to set a former environment?" asked yesterday. What is the best way to to return a function with a minimal environment from a function? Here is a dummy example: foo <- function(huge) { scale <- mean(huge) function(x) { scale * x } } fcn <- foo(1:10e5) The problem with this approach is that the environment of 'fcn' does not
2015 Oct 13
1
A where() functions that does what exists() does but return the environment when object lives?
On Tue, Oct 13, 2015 at 4:43 PM, Hadley Wickham <h.wickham at gmail.com> wrote: > Seems easy enough to write yourself: > > where <- function(x, env = parent.frame()) { > if (identical(env, emptyenv())) > return(NULL) > if (exists(x, envir = env, inherits = FALSE)) > return(env) > where(x, parent.env(env)) > } > > sample2 <-
2005 Nov 04
1
Changes to environments in R-devel
I've just committed some changes to R-devel which affect environments. Specifically: - using NULL as an environment is now deprecated: use baseenv() instead. (baseenv() is already available in R 2.2.0, where it returns NULL. For most purposes it retains the same meaning in R-devel.) If you do use NULL, it will be converted to baseenv(), and a warning printed. For example: > f
2008 Jul 29
1
environment question
Hi R users! I was looking at some of the example code for the "environment" function. Here it is: e1 <- new.env(parent = baseenv()) # this one has enclosure package:base. e2 <- new.env(parent = e1) assign("a", 3, envir=e1) ls(e1) ls(e2) exists("a", envir=e2) # this succeeds by inheritance exists("a", envir=e2, inherits = FALSE)
2006 Apr 25
7
R 2.3.0: Use of NULL as an environment is deprecated
Dear R-Devel subscriber, first, let me express my thank to the R-Core team for the new release! I appreciate their efforts and time spent to enhance R. In accordance with the 'NEWS' file (see excerpt of it below), [... o Changed the environment tree to be rooted in an empty environment, available as emptyenv(). baseenv() has been modified to return an environment with emptyenv() as
2006 Apr 25
7
R 2.3.0: Use of NULL as an environment is deprecated
Dear R-Devel subscriber, first, let me express my thank to the R-Core team for the new release! I appreciate their efforts and time spent to enhance R. In accordance with the 'NEWS' file (see excerpt of it below), [... o Changed the environment tree to be rooted in an empty environment, available as emptyenv(). baseenv() has been modified to return an environment with emptyenv() as
2010 Dec 23
2
data frame with nested data frame
Dear R-users, I am somewhat puzzled by how R treats data frames with nested data frames. Below are a couple of examples, maybe someone could help explain what the guiding logic here is. ## construct plain data frame > z <- data.frame(x=1) ## add a data frame member > z$y <- data.frame(a=1,b=2) ## puzzle 1: z is apparently different from a straightforward construction of the
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
2008 May 10
2
Hashes as S4 Classes, or: How to separate environments
For learning purposes mainly I attempted to implement hashes/maps/dictionaries (Python lingua) as S4 classes, see the coding below. I came across some rough S4 edges, but in the end it worked (for one dictionary). When testing ones sees that the dictionaries D1 and D2 share their environments D1 at hash and D2 at hash, though I thought a new and empty environment would be generated each time
2012 Jul 18
6
taylor expansions with real vectors
Dear list, I have a big deal concerning the development of a Taylor expansion. require(Matrix) e1 <- as.vector(1:5) e2 <- as.vector(6:10) in order to obtain all the combinations between these two vectors following a Taylor expansion (or more simply through a Maclaurin series) for real numbers. We have f(x) = f(0) + f'(0)(x-0) + f''(0)(x-0)^2/2! + ? + f^(k)(0)(x-0)^k/k!
2017 Aug 25
2
retrieve machine password in current Samba?
We have a wireless network that uses 802.1x authentication, in which domain joined computers use their machine credentials to connect. Windows machines do this automatically, and until recently Linux computers could join using wicd, wpa-supplicant, and a simple script that would retrieve the machine password with tdbdump. ( specifically tdbdump -k SECRETS/MACHINE_PASSWORD/DOMAIN
2019 Nov 18
2
BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"
On 11/18/19 9:18 AM, Martin Maechler wrote: >>>>>> Henrik Bengtsson >>>>>> on Sun, 17 Nov 2019 14:31:07 -0800 writes: > > $ R --vanilla R version 3.6.1 (2019-07-05) -- "Action of > > the Toes" Copyright (C) 2019 The R Foundation for > > Statistical Computing Platform: x86_64-pc-linux-gnu > > (64-bit) ...
2011 Jun 09
2
Coercing Output from mget() into Proper Data Frame
Hello R-philes: I have the following function that gets the output of mget() and converts it to a data frame to return. What I am finding is that the dimensions are wrong. Basically, I get: bridesmaid wed u see m gt lt like love X.0 dress pagetrack one go X3 get 1 56 35 27 30 24 20 20 23 28 17 25 16 16 28 15 26 Instead, I want something like: [1] bridesmaid