Re: [R] to print system.time always

2012-11-03 Thread jim holtman
I use notepad++ on Windows, so it is easy to add a "hotkey" that will surround a block of code that you want to execute with: system.time({..code to run..}) Usually you don't want it around each statement. I use the following function to have it print out CPU and memory usage at various

Re: [R] to print system.time always

2012-11-03 Thread Uwe Ligges
On 03.11.2012 19:42, jim holtman wrote: Here is a faster solution to your 'apply'; use 'sapply' instead: str(x) num [1:100, 1:30] 0.0346 0.4551 0.66 0.8528 0.5494 ... system.time(y <- apply(x, 1, cumsum)) user system elapsed 13.240.61 14.02 system.time(ys <- sapply(1:

Re: [R] to print system.time always

2012-11-03 Thread Uwe Ligges
On 03.11.2012 16:52, mrzung wrote: Hi all; I want to print system.time whenever I execute any command. It takes too much time to type "system.time()" function to all command. is there any solution on it? See ?Rprof on how to profile your code. And, apply(matrix,1,cumsum) command is too

Re: [R] to print system.time always

2012-11-03 Thread jim holtman
Here is a faster solution to your 'apply'; use 'sapply' instead: > str(x) num [1:100, 1:30] 0.0346 0.4551 0.66 0.8528 0.5494 ... > system.time(y <- apply(x, 1, cumsum)) user system elapsed 13.240.61 14.02 > system.time(ys <- sapply(1:col, function(a) cumsum(x[,a]))) user syst

[R] to print system.time always

2012-11-03 Thread mrzung
Hi all; I want to print system.time whenever I execute any command. It takes too much time to type "system.time()" function to all command. is there any solution on it? And, apply(matrix,1,cumsum) command is too slow to some large matrix. is there any function like rowCumSums ? thank u! -