Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(purrr)
- library(dplyr)
- library(microbenchmark)
- list <- map(1:1000, function(x) rep("a", 100))
- f1 <- function(list){
- reduce(list, c)
- }
- f2 <- function(list){
- map(list, function(x) data_frame(char = x)) %>%
- bind_rows() %>%
- .$char
- }
- microbenchmark(f1(list), f2(list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement