Yiwen Zhang
Aug 28 2014
namescolnames, rownamesdata.frame(a=, b=, )options(error=browser)browser()debug()debugSource()traceback()gamma, beta, …More general: apply, sapply, lapply, tapply, mapply
Profile your code first! Rprof
compiler
cmpfuncmpfile, loadcmpparallelcompare.tests <- function (n.pattern, sigma2.ratio, level = 0.05, null.size = 200000, mc.size = 10000)
parallel
require(parallel)
result.mcmapply <- mcmapply (
compare.tests,
rep (n.pattern.list, each = length (sigma2.ratio.list), times = 1),
rep (sigma2.ratio.list, each = 1, times = length (n.pattern.list)),
MoreArgs = list (mc.size = 10000), mc.cores = 12))
parallel
## build cluster
cl <- makeCluster (getOption ("cl.cores", 12) )
clusterSetRNGStream(cl, 123)
clusterExport (cl, c("generate.design", "generate.response", "lme", "pdIdent", "simulate.null.samples", "LRTSim", "RLRTSim"))
parallel
## Running the code
result.clusterMap <- clusterMap (
cl, compare.tests,rep (n.pattern.list, each = length (sigma2.ratio.list), times = 1),rep (sigma2.ratio.list, each = 1, times = length (n.pattern.list)), MoreArgs = list (mc.size = 10000), .scheduling = "static")
## Close down the cluster
stopCluster (cl)
parallel
foreach, pbdRR CMD BATCH --vanilla --args -1 practice.R Rout
Regular expression: gsub, grep, regexec
Visualization: ggplot2, ggvis
Data manipulation: dplyr, reshape2, data.table
Data frame with large data sets: H2O
Use C in R: Rcpp, Rcpp11
Use CUDA in R: gputools
Again, profile your code first! Rprof