0) Profiling your code

GUIProfiler Package

Profiling Example
library(GUIProfiler)

profile.func <- function() {
  
  apply.function <- function(data) {
    
    summary(data) 
    min(data); max(data)
    range(data)
    mean(data); median(data)
    sd(data); mad(data)
    IQR(data)
    quantile(data)
    quantile(data, c(1, 3)/4)
    
  }

  #start time
  strt<-Sys.time()
  
  data.list <- replicate(10, rnorm(500000), simplify=FALSE)
  
  lapply(data.list, apply.function)
  
  # time taken
  print(Sys.time()-strt)
  
}

RRprofStart()
profile.func()
RRprofStop()
RRprofReport()