I am trying to bind some sub elements of the elements from the list
The list OC
is as follows
> library(quantmod)
> OC <- getOptio
You can avoid do.call(rbind,...)
by using data.table::rbindlist
.
This will return a data.table
. data.tables
don't have rownames.
It is also blindingly fast!
library(data.table)
allputs <- rbindlist(lapply(OC, FUN = function(x) x$puts))
# my eyes, I'm blinded!
If you want to include the original rownames as a column then
lputs <- lapply(OC, FUN = function(x) x$puts)
allputs <- rbindlist(lputs)
# add the column with rownames
allputs[,rn := unlist(lapply(lputs, rownames))]
If you don't want to move to data.tables, then you could set the parent names to NULL
names(lputs) <- NULL
do.call('rbind', lputs)