[R] Time it takes to run a code

Maram SAlem marammagdysalem at gmail.com
Tue Oct 27 20:31:20 CET 2015


Thanks for helping Boris.

 Regards,
 Maram Salem

On 25 October 2015 at 23:30, Boris Steipe <boris.steipe at utoronto.ca> wrote:

> It may be useful for you to estimate the time complexity of your function:
> try it with smaller input that takes short and noticeable time, see whether
> the time increases linearly, quadratically, or exponentially with the
> number of elements you process, then  extrapolate to your full data set.
>
>
> To see what your function is doing, you could
> - add a print statement that tells you the progress every 1000 or 10,000
> items or so...
> - add a progress bar
>
> https://stat.ethz.ch/R-manual/R-patched/library/utils/html/txtProgressBar.html
> - install and use the pbapply package
>     https://cran.r-project.org/web/packages/pbapply/pbapply.pdf
>
>
> You are right to make sure you are getting some feedback, it is easy to
> make a mistake in function logic that will cause a function to fail to
> terminate.
>
>
> B.
>
>
>
> On Oct 25, 2015, at 5:05 PM, Maram SAlem <marammagdysalem at gmail.com>
> wrote:
>
> > Hi All,
> >
> > I'm using a function, say func, and I want to apply it to all the rows
> of a
> > certain matrix. The problem is that my code kept on running for more than
> > two days without giving any output. I've made some modifications.But is
> > there a way to know the time needed to execute my code and reach an ouput
> > but before running the code and not after it is run? I've tried
> Sys.time()
> > and system.time(), but still the console freezed for so long and I didn't
> > reach anything.
> >
> > Any suggestions are much appreciated.
> > Thanks in advance.
> >
> > Maram Salem
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list