[R] how to obtain the CPU time of my program

Christian Kohler Christian.Kohler at klinik.uni-regensburg.de
Wed Dec 12 12:31:51 CET 2007


first of all 'sorry' for my rather late post on this topic...

Did you already came across the R command 'Rprof' ? This might help you
to find answers to your problem in terms of CPU time/command.
I use 'Rprof' like this:


This produces a file called Rprof.out in your working directory.
Quit R and type 'R CMD Rprof Rprof.out'.

I am too new in using those profiling methods of R but I think they are
pretty handy.

Try out ?Rprof for detailed information.


gang xu wrote:
> Dear R users and experts,
> I am current running a program (a series of commands) in R. such as:
> A <- as.matrix(read.table("C:/LP.txt"));
> a=which(memb==q); b=a; B=as.matrix(A[a,b])
> LS=sum(B)/2;
> TL=sum(A)/2
> i<-c(1:NN);
> D=sum(A[a,i]);
> how can i obtain the CPU time used for these commands ?
> I have seen the system.time function but i am not sure how to use it. Could anyone help me ?
> ****** If we have a number of commands, how can we know the CPU for these commands *******
> Thanks a lot for your time and help
> Have a nice day!
> Warm Regards
> Marshall
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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.


Christian Kohler
Institute of Functional Genomics
Computational Diagnostics
University of Regensburg (BioPark I)
D-93147 Regensburg (Germany)

Tel. +49 941 943 5055
Fax  +49 941 943 5020
christian.kohler at klinik.uni-regensburg.de

More information about the R-help mailing list