Bert Gunter gunter.berton at gene.com writes:
Inline below.
-- No.
f - function(x, y = x)x+y ## lazy evaluation enables this
f(2)
[1] 4
f(2,3)
[1] 5
Ok, obviously I was not very precise about what I'd like to do. Sorry. I'm
aware of this functionality. But I'd like to use the
Thorn wrote:
Bert Gunter gunter.berton at gene.com writes:
Inline below.
-- No.
f - function(x, y = x)x+y ## lazy evaluation enables this
f(2)
[1] 4
f(2,3)
[1] 5
Ok, obviously I was not very precise about what I'd like to do. Sorry. I'm
Hi everybody,
how is it possible to refer to an argument passed to a function in the
function call? What I like to do, is something like
f - function(x,y) x+y
f(2, x) # should give 4
The problem is of course that x is only known inside the function. Of course I
could specify something like
I think you'll have to code it a bit different. I'd do :
f - function(x,y){
if(missing(y)) y -x
x+y
}
f(2)
[1] 4
f(2,3)
[1] 5
On Tue, May 4, 2010 at 4:26 PM, Thorn thorn.tha...@rdls.nestle.com wrote:
Hi everybody,
how is it possible to refer to an argument passed to a function in the
evaluation in function call
I think you'll have to code it a bit different. I'd do :
f - function(x,y){
if(missing(y)) y -x
x+y
}
f(2)
[1] 4
f(2,3)
[1] 5
On Tue, May 4, 2010 at 4:26 PM, Thorn thorn.tha...@rdls.nestle.com wrote:
Hi everybody,
how is it possible to refer to an argument passed
5 matches
Mail list logo