[R] function and apply

2005-06-05 Thread jose silva
Dear all    I think my problem is not complicated but I'm having difficulties to solve it. v is a vector: v=c(p1 , p2 , p3 , p4), and f  is a function: f : v - w , where w=c(p1 , p2*(1-p1) , p3*(1-p2)*(1-p1) , p4*(1-p3)*(1-p2)*(1-p1))   I write the function f as:

Re: [R] function and apply

2005-06-05 Thread Kjetil Brinchmann Halvorsen
jose silva wrote: Dear all Its very difficult to read your post due to all the blank lines, so I cannot really read it very well, but what about writing your function as (not tried) fun - function(x) c(x[1], or if that doesn't work look into ?mapply But you should really look into

Re: [R] function and apply

2005-06-05 Thread Gabor Grothendieck
On 6/5/05, jose silva [EMAIL PROTECTED] wrote: Dear all I think my problem is not complicated but I'm having difficulties to solve it. v is a vector: v=c(p1 , p2 , p3 , p4), and f is a function: f : v - w , where w=c(p1 , p2*(1-p1) , p3*(1-p2)*(1-p1) ,

Re: Re: [R] function and apply

2005-06-05 Thread jose silva
Kjetil and Gabor: thank you both so much for for yor help silva [EMAIL PROTECTED] wrote: Dear all I think my problem is not complicated but I'm having difficulties to solve it. v is a vector: v=c(p1 , p2 , p3 , p4), and f is a function: f : v - w , where w=c(p1 , p2*(1-p1) ,