Thorn wrote:
Bert Gunter 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 f
Bert Gunter 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 same i
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 wrote:
> Hi everybody,
>
> how is it possible to refer to an ar
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 wrote:
> Hi everybody,
>
> how is it possible to refer to an argument passed to a function in the
> function call? What I li
4 matches
Mail list logo