[R] to print system.time always
    jim holtman 
    jholtman at gmail.com
       
    Sat Nov  3 19:42:25 CET 2012
    
    
  
Here is a faster solution to your 'apply'; use 'sapply' instead:
> str(x)
 num [1:1000000, 1:30] 0.0346 0.4551 0.66 0.8528 0.5494 ...
> system.time(y <- apply(x, 1, cumsum))
   user  system elapsed
  13.24    0.61   14.02
> system.time(ys <- sapply(1:col, function(a) cumsum(x[,a])))
   user  system elapsed
   1.40    0.14    1.59
On Sat, Nov 3, 2012 at 11:52 AM, mrzung <mrzung46 at gmail.com> 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?
>
> And,
>
> apply(matrix,1,cumsum) command is too slow to some large matrix.
>
> is there any function like rowCumSums ?
>
> thank u!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/to-print-system-time-always-tp4648314.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
-- 
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
    
    
More information about the R-help
mailing list