rbinding a list of lists of dataframes based on nested order

后端 未结 1 927
轮回少年
轮回少年 2021-01-28 08:20

I have a dataframe, df and a function process that returns a list of two dataframes, a and b. I use dlply to split up the

1条回答
  •  佛祖请我去吃肉
    2021-01-28 09:15

    Not very clean but you can try something like this (assuming the same data generation process).

    list.aID <- lapply(1:4, function(x) {
    cbind(list[[(2*x) - 1]], list[[2*x]][1, 1, drop = FALSE])
    })
    
    all.aID <- rbind.fill(list.aID)
    all.aID
    
    all.aID
            d1       d2 id1
    1  0.68103 -0.74023   1
    2 -0.50684  1.23713   2
    3  0.33795 -0.37277   3
    4  0.37827  0.56892   4
    

    0 讨论(0)
提交回复
热议问题