dataframe - R: create data table from list of lists/list of numerics -


with data frames generating data frame list of lists quite straightforward. example:

 hists = lapply(sort(unique(country_hours$country)), function(x) get_hist_per_country(x, country_hours ) ) hists_df = data.frame(hists) 

this gets me dataframe number of columns equal length(hists)

however, if try make data table:

hists_dt = data.table(hists) 

and

hists_dt = data.table(lapply(hists, cbind)) 

both produce single column data table. how generate data table list of lists?


Comments