if statement - Loops inside functions in r -


I'm having trouble setting loops. I want to create a function that has many arguments and one of the arguments It is vector, and for every value of that vector, it should reduce an infinite series and sum

my code is such that :

  zt < -function (t, p, e) {for (in i) {v = 0; J = 0 repeat {v = v0; V = v + (i ^ j / factorial (j) ^ p) if (v-v0 and lt; e) break second j & lt; -j + 1}} return (v)} t = c (0.20.4,0.6,0.8); Zt (t, 0.50.00005)  

This returns the last value in the t and still i in each value T for .


Comments