Don't use apply functions if you want to do what you describe. They
don't work that way. Use a while control structure.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On October 9, 2014 10:24:49 PM PDT, PO SU <rhelpmaillist at 163.com>
wrote:>
>Dear expeRts,
>?? i? use sapply for loop,?and i want to break it when i needed, how to
>do that?? e.g.
>
>sapply( 1:10, function(i) {
>if(i==5) break and jump out of the function sapply
>} )
>
>I want to do it because i have to loop 1000000 times, but i don't know
>when it will break, that means, it may need break at i=5 or at i=50000,
>for the possible of the? last case, i don't use for loop, because it
>slow(is it right?).
>So,if you happen to know it ,may you help me?
>
>
>--
>
>PO SU
>mail: desolator88 at 163.com
>Majored in Statistics from SJTU
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.