R list of lists to data.frame

前端 未结 5 1303
夕颜
夕颜 2020-11-27 19:12

I\'ve got a list of lists, call it listHolder, which has length 5.

Every element in listHolder is a list of numeric data, with 160 or so e

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 19:32

    I think this is easier than the previous solutions:

    mydf = data.frame(x1 = c('a', 'b', 'c'))
    mylist = list(c(4, 5), c(4, 5), c(4, 5))
    mydf$x2 = mylist
    print(mydf)
      x1   x2
    1  a 4, 5
    2  b 4, 5
    3  c 4, 5
    

提交回复
热议问题