,
: Vadim
:
: -Original Message-
: From: r-help-bounces at stat.math.ethz.ch
: [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gabor
: Grothendieck
: Sent: Tuesday, March 08, 2005 4:06 PM
: To: r-help at stat.math.ethz.ch
: Subject: Re: [R] how modify object in parent.env
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gabor
Grothendieck
Sent: Tuesday, March 08, 2005 4:06 PM
To: r-help@stat.math.ethz.ch
Subject: Re: [R] how modify object in parent.env
You can use - like this:
x - 1:3
local(x[1] - x[1]+1
This isn't an environment problem. Assigning something to a get call
doesn't make any sense. Use assign.
a - 5
get(a) - 10
Error: couldn't find function get-
And from the ?assign help page, you can pick what environment you want
to make the assignment. Just pick the parent environment.
Assign() re-binds the value, not modifies it (the latter is what I
needed)
-Original Message-
From: McGehee, Robert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 08, 2005 3:48 PM
To: Vadim Ogranovich; r-help@stat.math.ethz.ch
Subject: RE: [R] how modify object in parent.env
On Tue, 2005-03-08 at 15:36 -0800, Vadim Ogranovich wrote:
Hi,
Is it possible to modify an object in the parent.env (as opposed to
re-bind)? Here is what I tried:
x = 1:3
# try to modify the first element of x from within a new environment
local(get(x, parent.env(environment()))[1] -
]
: Sent: Tuesday, March 08, 2005 3:48 PM
: To: Vadim Ogranovich; r-help at stat.math.ethz.ch
: Subject: RE: [R] how modify object in parent.env
:
: This isn't an environment problem. Assigning something to a
: get call doesn't make any sense. Use assign.
:
: a - 5
: get(a) - 10
: Error