[R] timing a function

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Mon May 17 21:06:44 CEST 2010


On Mon, May 17, 2010 at 6:24 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:

> Try
>  system.time(y <- f(x))
>
> and see ?"=".
>
>  -Peter Ehlers

 Ah ha. That explains the curly brackets I saw in a posting with
system.time on stack overflow just now:

 system.time({y=f(x)})

 works as expected since the {} pair make a new code block. Also you
can then time more than one statement:

 system.time({y=f(x);z=g(y)})

 - gives the total time for f(x) and g(y).

Barry



More information about the R-help mailing list