Displaying 20 results from an estimated 37079 matches for "environment".
2002 Oct 13
1
The class attribute on an environment seems buggy (PR#2159)
Full_Name: Henrik Bengtsson
Version: 1.6.0, 1.5.1
OS: WinXP Pro
Submission from: (NULL) (128.250.252.82)
The following example, which I tested on both R v1.5.1 and R v1.6.0 on WinXP
Pro, shows the problem I encountered when trying to use the class attribute of
an environment:
# Define method print() for class Environment
C
print(e)
# gives:
# [1] "An Environment!"
# Exit [R]
q(save="yes")
When restarting [R] and loading the previous workspace something goes wrong(?):
% R
print(e)
# gives:
# <environment: 01BE52F4>
# attr(,"class"...
2005 Sep 27
3
Dummy quesion about environment
Hi,
I'm trying to understand environment object in R.
I used the example:
f <- function(x) {
y <- 10
g <- function(x) x + y
return(g)
}
h <- f()
h(3)
then i saw that f return an environment
> h
function(x) x + y
<environment: 01B28570>
but I coudn't access to x and y obj...
2004 Jun 14
5
terminology for frames and environments
In ?exists it says:
inherits: should the enclosing frames of the environment be searched?
I believe what it is saying is that if inherits is TRUE and it fails
to find the variable it will look in the parent environment and
the parent of the parent, etc. (as opposed to looking in the calling
frame next and the caller of the caller, etc.)
Now I thought that standard termino...
2016 Dec 12
2
why does parent.frame() cycle when called from inside capture.output()?
Hello R devel/help,
I ran into this strange behavior:
# showstack is supposed to walk through the stack of parent
# environments when it is called:
showstack = function() {
env = environment()
for(i in 1:12) {
env = do.call(parent.frame, list(), env=env)
print(env)
}
}
# a simple chain of functions:
g3=function(t) showstack()
g2=function(w) g3(w)
g1=function(z) g2(z...
2016 Dec 12
2
why does parent.frame() cycle when called from inside capture.output()?
Hello R devel/help,
I ran into this strange behavior:
# showstack is supposed to walk through the stack of parent
# environments when it is called:
showstack = function() {
env = environment()
for(i in 1:12) {
env = do.call(parent.frame, list(), env=env)
print(env)
}
}
# a simple chain of functions:
g3=function(t) showstack()
g2=function(w) g3(w)
g1=function(z) g2(z...
2014 May 17
1
environment question
According to
:https://stat.ethz.ch/R-manual/R-devel/library/base/html/environment.html
"If |fun| is a function or a formula then |environment(fun)| returns the
environment associated with that function or formula. If |fun| is |NULL|
then the current evaluation environment is returned."
> environment()
<environment: R_GlobalEnv>
> environment(environme...
2008 Mar 07
3
merging environments
...of various R-core folks
who feel that mle() doesn't need a "data" argument, and
that users would be better off learning to deal with function
closures, I am *still* trying to make such things work
in a reasonably smooth fashion ...
Is there a standard idiom for "merging" environments?
i.e., suppose a function has an environment that I want
to preserve, but _add_ the contents of a data list --
would something like this do it? Is there a less ugly
way?
x <- 0
y <- 1
z <- 2
f <- function() {
x+y+z
}
f2 <- function(fun,data) {
L <- ls(pos=environment...
2010 Dec 14
7
Environment specified by external nodes ignored
My custom external nodes script sets the environment variable, but Puppet
ignores it.
For testing, I have a manifest that deploys this template to a file:
environment = <%= environment %>
The output from my external nodes script:
---
classes:
- devhost
environment: development
parameters:
memcached_memory: ''32''
But runnin...
2015 Oct 09
4
A where() functions that does what exists() does but return the environment when object lives?
Hi,
exists("foo", inherits=TRUE) check whether an object named "foo"
exists, and get("foo", inherits=TRUE) retrieves it. I'm looking for a
similar function to exists() that returns the environment where the
object "foo" exists, iff at all. If not found, NULL is returned.
Does that exist?
EXAMPLE #1:
> sample2 <- base::sample
> env <- where("sample2", inherits=TRUE)
> env
<environment: R_GlobalEnv>
Note the difference to:
> obj <- get("...
2013 Aug 19
3
Puppet environments vs App environments
I''ve setup dynamic environments using git but I''m confused about how
environments are actually supposed to be used. We''re a small ISP and have
freeradius servers, VPN servers and web servers. I''ve been using
environments to enable me as the sysadmin to build and test new
manifests/modules before de...
2007 Sep 18
1
Re-attaching a package environment drops the attributes
Hi.
contrary to other environments, the attributes of a *package*
environment are dropped (from the new environment) when attach():ing
it to the search() path. This might or might not be surprising, but
have some side effects if rearranging/attaching package environments.
# Example - Regular environments
env <- new.env()
attr(...
2005 Nov 24
2
what's the meaning of these in R-lang?
In this case the environment contains the variables local to the function, and its enclosure is the environment of the enclosing function.(R-lang:p11)
I want to know if the "enclosing function" means the closure of the function? for example ,if I call function mean(),and the create an environment,say e1,then the enc...
2010 Apr 27
2
when setting environment: target of assignment expands to non-language object
Hi,
I am trying to place my own functions in the nlme environment:
The following statement works:
environment(coef.corSPT) <- environment(getS3method("coef","corSpatial"))
but this one returns an error:
environment(get("coef<-.corSPT")) <-
environment(getS3method("coef<-","corSpatial"))
Error in en...
2012 Nov 25
0
Problema de compilacion con Rcpp
...cumulate( xx.begin(), xx.end(), 0.0));'
> add <- cxxfunction(signature(x = "numeric"), body, plugin = "Rcpp")
cygwin warning:
MS-DOS style path detected: C:/R-215~1.2/etc/i386/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R-215~1.2/etc/i386/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
C:/R-2.15.2/library/Rcpp/lib/i386/libRcpp.a(RObject.o):RObject.cpp:(.text+0x3ac): undefined referenc...
2016 Dec 05
2
imapsieve environment variables missing?
...re statements involved.
>>
>> I don't know how I managed to compile only using direct access of
>> ${imap.user} before since now I get an unknown namespace error on my
>> test script.
>>
>> But doing it this way compiles:
>>
>> require ["environment", "variables", "vnd.dovecot.debug"];
>>
>> if environment :matches "imap.user" "*" {
>> set "u" "${1}"; }
>> debug_log "Found username: \${u}";
>> if environment :matches "name" &qu...
2010 Dec 26
2
environment question
...ing up against the problem that packages
use coding idioms that are unfamiliar to me.
A difficult thing for me is explaining scope of variables in R
functions. When should we pass an object to a function, when should
we let the R system search about for an object? I've been puzzling
through ?environment for quite a while.
Here's an example from one of the packages that I like, called "ltm".
In the function "ltm.fit" the work of calculating estimates is sent to
different functions like "EM' and "loglikltm" and "scoreltm". Before
that, this is u...
2020 Aug 09
3
lm() takes weights from formula environment
...in formula and data frame. But, from a statistical user point of view this seems to be counter-productive. At best it works as if the user is passing in the name of the weights variable instead of values (I know this is the obvious consequence of NSE).
lm() takes instance weights from the formula environment. Usually that environment is the interactive environment or a close child of the interactive environment and we are lucky enough to have no intervening name collisions so we don't have a problem. However it makes programming over formulas for lm() a bit tricky. Here is an example of the issue....
2009 Dec 10
2
Assigning variables into an environment.
...ith a somewhat complicated structure in which
I need to deal with a function that takes ``basic'' arguments
and also depends on a number of parameters which change depending
on circumstances.
I thought that a sexy way of dealing with this would be to assign
the parameters as objects in the environment of the function in
question.
The following toy example gives a bit of the flavour of what I
am trying to do:
foo <- function(x,zeta) {
for(nm in names(zeta)) assign(nm,zeta[nm],envir=environment(bar))
bar(x)
}
bar <- function(x) {
alpha + beta*exp(gamma*x)
}
v <- c(alpha=2,beta=3,gamma...
2015 Aug 10
2
pigeonhole/lda accessing -m folder
complete patch. some parts were missing before
diff --git a/src/lib-sieve/plugins/environment/ext-environment-common.c
b/src/lib-sieve/plugins/environment/ext-environment-common.c
--- a/src/lib-sieve/plugins/environment/ext-environment-common.c
+++ b/src/lib-sieve/plugins/environment/ext-environment-common.c
@@ -24,7 +24,8 @@ static const struct sieve_environment_item
*core_env_items[] = {...
2006 Sep 18
1
BSD Auth: set child environment variables requested by login script [PATCH]
Hello,
in the BSD Authentication system the login script can request environment
variables to be set/unset. The call to auth_close() in auth-passwd.c does
change the current environment, but those changes are lost for the child
environment.
It would be really useful to add some kind of mechanism to get
those changes into the child environment. I've added two possible
solut...