How to combine result of lapply to a data.frame?
You can also use data.table
's rbindlist
as follows:
require(data.table)
df <- setDF(rbindlist(lapply(my_vector, my_function)))
Without setDF
rbindlist returns a data.table
instead of a data.frame
Try
library(dplyr)
lapply(my_vector, my_function) %>% bind_rows()