[R] Performing a geometric seqeunce using iterators?

Erik Iverson eriki at ccbr.umn.edu
Wed Nov 10 05:41:00 CET 2010


On 11/09/2010 09:16 PM, vicho wrote:
>
> I want to make a function for geometric seqeunce
>
> since
>
> testing=function(x){i=1;ans=1;while(true){ans=ans+(1/x)^i ; i=i+1}
> ;return(ans)}
>
> doesn't work... the program is freeze...

What exactly are you trying to do?  Where does "true" get set?
Did you mean TRUE? We need more information.

from my research, i know i should
> use iterators.
>
> I read iterators.pdf at
> http://cran.r-project.org/web/packages/iterators/iterators.pdf and didnt
> find it helps solving my problem at all...
>
> Is there any sources I can look up to?
>
> Thanks
> Ting



More information about the R-help mailing list