Yiwen Zhang
Aug 28 2014
names
colnames
, rownames
data.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
cmpfun
cmpfile
, loadcmp
parallel
compare.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
, pbdR
R 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