Skip to content
Prev 351308 / 398502 Next

Using lapply when there are dependencies

For loops are not slow. Inefficient memory management in for loops is slow.  Feel free to preallocate your output vectors and write for loops to your heart's content. If you really want speed you can write this in C++ using Rcpp [1]. If your f() is a standard digital filter algorithm this has already been done for you (see ?filter).

[1] https://stat.ethz.ch/pipermail/r-help//2014-December/424027.html
---------------------------------------------------------------------------
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 May 27, 2015 4:34:01 PM PDT, blue honour via R-help <r-help at r-project.org> wrote: