Search
 
SCRIPT & CODE EXAMPLE
 

R

reduce list in parallel r

out1 <- replicate(1000, 1:20, simplify=FALSE)  # use 1000 elements for illustrative purposes

library(microbenchmark)    
microbenchmark(times=10,
  a <- do.call(rbind, out1),
  b <- matrix(unlist(out1), ncol=20, byrow=TRUE),
  c <- Reduce(rbind, out1)
)
# Unit: microseconds
#                                                expr        min         lq
#                           a <- do.call(rbind, out1)    469.873    479.815
#  b <- matrix(unlist(out1), ncol = 20, byrow = TRUE)    257.263    260.479
#                            c <- Reduce(rbind, out1) 110764.898 113976.376
all.equal(a, b, check.attributes=FALSE)
# [1] TRUE
all.equal(b, c, check.attributes=FALSE)
# [1] TRUE
Comment

PREVIOUS NEXT
Code Example
R :: r range with step 
R :: rmarkdown section title as variable ## 
R :: r na omit column 
R :: counting by 2 columns in r 
R :: r convert matrix to list of column vectors 
R :: negative binomial distribution rstudio 
R :: fourier in R 
R :: pi in r 
R :: ggplot - blank title of axis 
R :: text in ggplot2 
R :: r remove all string before : in r data frame 
R :: regex in r 
R :: sequence r 
R :: r ggplot stacked bar labels 
R :: percent of missing data in df r 
R :: ggplot abline thickness 
R :: R language get all columns in a dataset 
R :: autoplot confusion matrix 
R :: how to remove columns in a table in r 
R :: ggplot2 reverse order of scale_brewer color 
R :: generate bin frequency table in R 
R :: R change column to row names 
R :: index in r 
R :: r select column names starting with 
R :: concatenate r 
Rust :: bevy bundles 
Rust :: rust case 
Rust :: sleep in rust 
Rust :: rust init vec with values 
Rust :: armanriazi•rust•static•vs•cons 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =