On 2010-05-17 10:49, Gustave Lefou wrote:
Dear all,

I have a function f(x).
ptm<- proc.time()
y=f(x)
proc.time() - ptm

works fine for me.

However it is not possible to write

system.time(y=f(x))

and

system.time(f(x))

does not store the value of f(x).

Should I prefer the 3 lines with proc.time ?

No. You should be careful in your use of '=' which is only allowed at top level.

Try
 system.time(y <- f(x))

and see ?"=".

 -Peter Ehlers


Thank you very much,
Gustave



2010/5/4 Joris Meys<jorism...@gmail.com>

?system.time can help too.

On Tue, May 4, 2010 at 11:07 PM, pdb<ph...@philbrierley.com>  wrote:


Hi,
I want to time how long a function takes to execute. Any clues on what to
search for to achieve this?

Thanks in advance.
--
View this message in context:
http://r.789695.n4.nabble.com/timing-a-function-tp2126319p2126319.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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<http://www.r-project.org/posting-guide.html>
and provide commented, minimal, self-contained, reproducible code.




--
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[alternative HTML version deleted]]

______________________________________________
R-help@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<http://www.r-project.org/posting-guide.html>
and provide commented, minimal, self-contained, reproducible code.


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.


______________________________________________
R-help@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.

Reply via email to