<- 1
}
after calling f1, the value of i becomes 1. Now, suppose that f1 is
called in another function f2, and i is initialized in f2 as well, i.e:
f2 = function(n){
i = n
f1(i)
}
The intention is, after executing f2, i=1 (not i=n).
--- On Thu, 8/6/09, Steve Lianoglou
wrote:
From: S
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
.
Thank you very much for the help!
Best Regards
Ivo
--- On Fri, 8/7/09, markle...@verizon.net wrote:
> From: markle...@verizon.net
> Subject: Re: Re: Re: [R] A question regarding R scoping
> To: idc...@yahoo.com
> Date: Friday, August 7, 2009, 6:57 PM
> Hi Ivo: There's somet
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Ivo Shterev
> Sent: Friday, August 07, 2009 9:36 AM
> To: murd...@stats.uwo.ca; markle...@verizon.net
> Cc: r-help@r-project.org
> Subject: Re: [R] A questio
- On Fri, 8/7/09, markle...@verizon.net wrote:
> From: markle...@verizon.net
> Subject: Re: Re: [R] A question regarding R scoping
> To: murd...@stats.uwo.ca
> Cc: idc...@yahoo.com, r-help@r-project.org
> Date: Friday, August 7, 2009, 8:33 AM
> Hi Gabor, Steve, Eric and Duncan: I
>
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
(n){
i = n
f1(i)
}
The intention is, after executing f2, i=1 (not i=n).
That is what you get. What is the question?
Duncan Murdoch
--- On Thu, 8/6/09, Steve Lianoglou wrote:
From: Steve Lianoglou
Subject: Re: [R] A question regarding R scoping
To: "Ivo Shterev"
Cc: r-he
length(n)
> f1(i)
> print(i)}
>
> i.e. f2 should print 1, not length(n).
>
> ivo
>
>
> --- On Thu, 8/6/09, Steve Lianoglou wrote:
>
>> From: Steve Lianoglou
>> Subject: Re: [R] A question regarding R scoping
>> To: "Ivo Shterev"
>> Cc
}
The intention is, after executing f2, i=1 (not i=n).
--- On Thu, 8/6/09, Steve Lianoglou wrote:
> From: Steve Lianoglou
> Subject: Re: [R] A question regarding R scoping
> To: "Ivo Shterev"
> Cc: r-help@r-project.org
> Date: Thursday, August 6, 2009, 10:23 PM
> Howd
Sent: Thursday, August 06, 2009 3:11 PM
To: Steve Lianoglou
Cc: r-help@r-project.org
Subject: Re: [R] A question regarding R scoping
Hi,
The intention is that after executing f2, the value of i to become 1.
f1 = function(i){i = 1}
f2 = function(n){ i = length(n)
f1(i)
print(i)}
i.e. f2 should print 1
Lianoglou
Subject: Re: [R] A question regarding R scoping
To: "Ivo Shterev"
Cc: r-help@r-project.org
Date: Thursday, August 6, 2009, 3:07 AM
Hi,
On Aug 5, 2009, at 5:55 PM, Ivo Shterev wrote:
> I have a question related to scoping. Suppose we have
2 functions:
>
> f1 = functio
Howdy,
On Aug 6, 2009, at 4:11 PM, Ivo Shterev wrote:
Hi,
The intention is that after executing f2, the value of i to become 1.
f1 = function(i){i = 1}
f2 = function(n){ i = length(n)
f1(i)
print(i)}
i.e. f2 should print 1, not length(n).
Yeah, you can using parent.frame()'s and such:
f
Hi,
The intention is that after executing f2, the value of i to become 1.
f1 = function(i){i = 1}
f2 = function(n){ i = length(n)
f1(i)
print(i)}
i.e. f2 should print 1, not length(n).
ivo
--- On Thu, 8/6/09, Steve Lianoglou wrote:
> From: Steve Lianoglou
> Subject: Re: [R] A qu
Hi,
On Aug 5, 2009, at 5:55 PM, Ivo Shterev wrote:
I have a question related to scoping. Suppose we have 2 functions:
f1 = function(i){i = 1}
f2 = function(n){
i = length(n)
f1(i)
}
In other words, I would like i=1 regardless of n. Is this possible
without having f1 in the body of f2? Than
I have a question related to scoping. Suppose we have 2 functions:
f1 = function(i){i = 1}
f2 = function(n){
i = length(n)
f1(i)
}
In other words, I would like i=1 regardless of n. Is this possible without
having f1 in the body of f2? Thanks in advance!
15 matches
Mail list logo