Converting nested list to dataframe

后端 未结 3 2203
南旧
南旧 2020-11-27 03:14

The goal is to convert a nested list which sometimes contain missing records into a data frame. An example of the structure when there are missing records is:



        
3条回答
  •  一生所求
    2020-11-27 03:50

    You can also use (at least v1.9.3) of rbindlist in the data.table package:

    library(data.table)
    
    rbindlist(mylist, fill=TRUE)
    
    ##      Hit Project Year Rating      Launch  ID    Dept            Error
    ## 1:  True    Blue 2011      4 26 Jan 2012  19 1, 2, 4               NA
    ## 2: False      NA   NA     NA          NA  NA      NA Record not found
    ## 3:  True   Green 2004      8 29 Feb 2004 183    6, 8               NA
    

提交回复
热议问题