[R] Using apply function

Yen Lee b88207001 at ntu.edu.tw
Mon Jan 27 14:56:14 CET 2014


Hi all R-users,

I'm trying to using apply function to input a range of values into a 
function I wrote.
I wrote a function with 4 information needed. I would like to make 2 of 
them fixed and the other 2 random (but with specified values).
I would like to replicate the function 10000 times.
I was thinking about using loop function but which is really slow, 
therefore I transfer to apply function.
But I got stucked. Could anyone help me?

The question could be illustrated as follows,
Target function: fun(F1,F2,R1,R2)
R1 has values 1, 2, 3, 4, 5
R2 has values -1, -2, -3, -4, -5
F1=10
F2=100
There would be 25 conditions. I would like to avoid using loop to get 
the result.
Could anyone give me some precious suggestion?

Thank you!!!!

Best,
Yen



More information about the R-help mailing list