Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. library(purrr)
  2. library(dplyr)
  3. library(microbenchmark)
  4.  
  5. list <- map(1:1000, function(x) rep("a", 100))
  6.  
  7. f1 <- function(list){
  8. reduce(list, c)
  9. }
  10.  
  11. f2 <- function(list){
  12. map(list, function(x) data_frame(char = x)) %>%
  13. bind_rows() %>%
  14. .$char
  15. }
  16.  
  17. microbenchmark(f1(list), f2(list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement