fFactory <- function(args) {
a <- complicated_a_computation(args)
b <- complicated_b_computation(args)
function(x) a*x + b*exp(x)
}
f1 <- fFactory(args1)
f2 <- fFactory(args2)
f1(x)
f2(x) # will get different result than f1(x)
f1 and f2 will look the same but produce different results
On 08/10/2014 5:53 AM, H. Dieter Wilhelm wrote:
Duncan Murdoch writes:
> On 07/10/2014 2:45 AM, H. Dieter Wilhelm wrote:
>> Hello (),
>>
>> I'd like to do the following
>>
>> a <- 3
>> f1 <- function (x){
>> a*x^2
>> }
>>
>> a <- 5
>> f2 <- function (x){
>> a*x^2
>> }
>>
>> plotting f1, f2,
Duncan Murdoch writes:
> On 07/10/2014 2:45 AM, H. Dieter Wilhelm wrote:
>> Hello (),
>>
>> I'd like to do the following
>>
>> a <- 3
>> f1 <- function (x){
>> a*x^2
>> }
>>
>> a <- 5
>> f2 <- function (x){
>> a*x^2
>> }
>>
>> plotting f1, f2, ...
>>
>> but f1 and f2 are the same, how can I e
On 07/10/2014 2:45 AM, H. Dieter Wilhelm wrote:
Hello (),
I'd like to do the following
a <- 3
f1 <- function (x){
a*x^2
}
a <- 5
f2 <- function (x){
a*x^2
}
plotting f1, f2, ...
but f1 and f2 are the same, how can I evaluated the variables in the
function definition?
Thank you
Di
Hello (),
I'd like to do the following
a <- 3
f1 <- function (x){
a*x^2
}
a <- 5
f2 <- function (x){
a*x^2
}
plotting f1, f2, ...
but f1 and f2 are the same, how can I evaluated the variables in the
function definition?
Thank you
Dieter
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Ger
5 matches
Mail list logo